/* ============================================================
   Test My Fiber — Premium Network Quality Dashboard
   Design System & Styles

   Desenvolvido por HT Technology
   © 2026 HT Technology — Todos os direitos reservados
   ============================================================ */

/* ---------- Self-Hosted Fonts (Zero Trust: no external CDN dependency) ---------- */
/* Downloaded from Google Fonts and served locally for supply chain security */

/* Inter — Primary UI font */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter-400.ttf') format('truetype');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/inter-600.ttf') format('truetype');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/inter-700.ttf') format('truetype');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/inter-800.ttf') format('truetype');
}

/* JetBrains Mono — Monospace font for metrics */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/jetbrainsmono-400.ttf') format('truetype');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/jetbrainsmono-600.ttf') format('truetype');
}

/* ---------- CSS Custom Properties (Design Tokens) ---------- */
:root {
  /* Background palette */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.65);
  --bg-card-hover: rgba(17, 24, 39, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-glass-hover: rgba(255, 255, 255, 0.08);

  /* Text palette */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #38bdf8;

  /* Accent / Neon palette */
  --accent-blue: #38bdf8;
  --accent-cyan: #22d3ee;
  --accent-green: #4ade80;
  --accent-yellow: #facc15;
  --accent-orange: #fb923c;
  --accent-red: #f87171;
  --accent-purple: #a78bfa;
  --accent-pink: #f472b6;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #38bdf8 0%, #a78bfa 100%);
  --gradient-success: linear-gradient(135deg, #4ade80 0%, #22d3ee 100%);
  --gradient-warning: linear-gradient(135deg, #facc15 0%, #fb923c 100%);
  --gradient-danger: linear-gradient(135deg, #f87171 0%, #f472b6 100%);
  --gradient-hero: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(167, 139, 250, 0.15) 100%);
  --gradient-gauge-bg: conic-gradient(from 135deg, #1e293b 0%, #0f172a 100%);

  /* Glassmorphism */
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
  --glass-blur: 16px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow-blue: 0 0 20px rgba(56, 189, 248, 0.3);
  --shadow-glow-green: 0 0 20px rgba(74, 222, 128, 0.3);
  --shadow-glow-red: 0 0 20px rgba(248, 113, 113, 0.3);

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Theme transition */
  --theme-transition: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Light Theme Overrides ---------- */
[data-theme="light"] {
  /* Background palette */
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-card-hover: rgba(255, 255, 255, 0.92);
  --bg-glass: rgba(0, 0, 0, 0.03);
  --bg-glass-hover: rgba(0, 0, 0, 0.06);

  /* Text palette */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-accent: #0284c7;

  /* Accent palette (slightly deeper for contrast on light) */
  --accent-blue: #0284c7;
  --accent-cyan: #0891b2;
  --accent-green: #16a34a;
  --accent-yellow: #ca8a04;
  --accent-orange: #ea580c;
  --accent-red: #dc2626;
  --accent-purple: #7c3aed;
  --accent-pink: #db2777;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #0284c7 0%, #7c3aed 100%);
  --gradient-success: linear-gradient(135deg, #16a34a 0%, #0891b2 100%);
  --gradient-warning: linear-gradient(135deg, #ca8a04 0%, #ea580c 100%);
  --gradient-danger: linear-gradient(135deg, #dc2626 0%, #db2777 100%);
  --gradient-hero: linear-gradient(135deg, rgba(2, 132, 199, 0.08) 0%, rgba(124, 58, 237, 0.08) 100%);
  --gradient-gauge-bg: conic-gradient(from 135deg, #e2e8f0 0%, #f0f4f8 100%);

  /* Glassmorphism */
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --glass-blur: 20px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-glow-blue: 0 0 20px rgba(2, 132, 199, 0.2);
  --shadow-glow-green: 0 0 20px rgba(22, 163, 74, 0.2);
  --shadow-glow-red: 0 0 20px rgba(220, 38, 38, 0.2);
}

/* Smooth theme transition on key elements */
body,
.glass-card,
.score-banner,
.app-header,
.app-footer,
.test-log,
.fiber-health-section,
.metric-icon,
.btn-primary,
.btn-secondary,
.info-table td,
.card-badge {
  transition:
    background var(--theme-transition),
    color var(--theme-transition),
    border-color var(--theme-transition),
    box-shadow var(--theme-transition);
}

/* Light theme specific overrides */
[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(2, 132, 199, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(124, 58, 237, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse 50% 60% at 50% 80%, rgba(22, 163, 74, 0.03) 0%, transparent 50%);
}

[data-theme="light"] .test-log {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .log-entry {
  border-bottom-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .gauge-bg {
  stroke: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .speed-gauge .gauge-track {
  stroke: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .gauge-ticks line {
  stroke: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .gauge-ticks line.major {
  stroke: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .progress-track {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .logo-icon svg path {
  fill: white;
}

[data-theme="light"] .fiber-health-section {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.04) 0%, rgba(22, 163, 74, 0.04) 50%, rgba(124, 58, 237, 0.04) 100%);
  border-color: rgba(2, 132, 199, 0.12);
}

[data-theme="light"] .metric-icon.icon-blue { background: rgba(2, 132, 199, 0.1); }
[data-theme="light"] .metric-icon.icon-green { background: rgba(22, 163, 74, 0.1); }
[data-theme="light"] .metric-icon.icon-yellow { background: rgba(202, 138, 4, 0.1); }
[data-theme="light"] .metric-icon.icon-red { background: rgba(220, 38, 38, 0.1); }
[data-theme="light"] .metric-icon.icon-purple { background: rgba(124, 58, 237, 0.1); }
[data-theme="light"] .metric-icon.icon-cyan { background: rgba(8, 145, 178, 0.1); }
[data-theme="light"] .metric-icon.icon-pink { background: rgba(219, 39, 119, 0.1); }
[data-theme="light"] .metric-icon.icon-orange { background: rgba(234, 88, 12, 0.1); }

[data-theme="light"] .badge-success { background: rgba(22, 163, 74, 0.12); }
[data-theme="light"] .badge-warning { background: rgba(202, 138, 4, 0.12); }
[data-theme="light"] .badge-danger { background: rgba(220, 38, 38, 0.12); }
[data-theme="light"] .badge-info { background: rgba(2, 132, 199, 0.12); }
[data-theme="light"] .badge-neutral { background: rgba(100, 116, 139, 0.12); }

[data-theme="light"] .mini-bar {
  opacity: 0.85;
}

/* ---------- Theme Toggle Button ---------- */
.theme-toggle {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
  background: var(--bg-glass);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-spring),
    box-shadow var(--transition-base);
  overflow: hidden;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-glass-hover);
  border-color: rgba(255, 255, 255, 0.15);
  transform: scale(1.1);
  box-shadow: var(--shadow-glow-blue);
}

[data-theme="light"] .theme-toggle:hover {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.3);
}

.theme-toggle:active {
  transform: scale(0.92);
}

/* Sun & Moon Icons */
.theme-icon {
  position: absolute;
  width: 20px;
  height: 20px;
  transition:
    transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 300ms ease;
}

/* Dark mode default: show moon, hide sun */
.theme-icon-sun {
  color: var(--accent-yellow);
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.theme-icon-moon {
  color: var(--accent-blue);
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Light mode: show sun, hide moon */
[data-theme="light"] .theme-icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
  color: #ca8a04;
}

[data-theme="light"] .theme-icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

/* Glow ring animation on toggle */
@keyframes themeTogglePulse {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(56, 189, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

[data-theme="light"] .theme-toggle.pulse-animate {
  animation: themeTogglePulseLight 600ms ease-out;
}

.theme-toggle.pulse-animate {
  animation: themeTogglePulse 600ms ease-out;
}

@keyframes themeTogglePulseLight {
  0% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(250, 204, 21, 0); }
  100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .theme-icon {
    transition: opacity 150ms ease;
  }
  .theme-icon-sun,
  .theme-icon-moon,
  [data-theme="light"] .theme-icon-sun,
  [data-theme="light"] .theme-icon-moon {
    transform: none;
  }
  .theme-toggle.pulse-animate,
  [data-theme="light"] .theme-toggle.pulse-animate {
    animation: none;
  }
}

/* ---------- 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);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background mesh */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(56, 189, 248, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(167, 139, 250, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 50% 60% at 50% 80%, rgba(74, 222, 128, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Layout ---------- */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-xl);
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  margin-bottom: var(--space-xl);
  border-bottom: 1px solid var(--glass-border);
}

.logo-group {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.logo-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow-blue);
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { box-shadow: var(--shadow-glow-blue); }
  50% { box-shadow: 0 0 30px rgba(56, 189, 248, 0.5); }
}

.logo-icon svg {
  width: 28px;
  height: 28px;
  fill: white;
}

.logo-text h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.header-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.header-meta-item svg {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-dot.offline {
  background: var(--accent-red);
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.6);
}

/* ---------- Cards (Glass) ---------- */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--glass-shadow);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-lg);
}

.glass-card.interactive:hover {
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.card-title svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.card-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-success { background: rgba(74, 222, 128, 0.15); color: var(--accent-green); }
.badge-warning { background: rgba(250, 204, 21, 0.15); color: var(--accent-yellow); }
.badge-danger { background: rgba(248, 113, 113, 0.15); color: var(--accent-red); }
.badge-info { background: rgba(56, 189, 248, 0.15); color: var(--accent-blue); }
.badge-neutral { background: rgba(148, 163, 184, 0.15); color: var(--text-secondary); }

/* ---------- Overall Score Banner ---------- */
.score-banner {
  background: var(--gradient-hero);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-2xl);
  margin-bottom: var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  position: relative;
  overflow: hidden;
}

.score-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.score-info {
  flex: 1;
}

.score-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-sm);
}

.score-value-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.score-value {
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
}

.score-max {
  font-size: 1.5rem;
  color: var(--text-muted);
  font-weight: 600;
}

.score-grade {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 4px 16px;
  border-radius: var(--radius-full);
}

.score-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 460px;
  line-height: 1.7;
}

/* Score gauge SVG */
.score-gauge-container {
  flex-shrink: 0;
  width: 200px;
  height: 200px;
  position: relative;
}

.score-gauge-container svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 10;
}

.gauge-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.5s;
}

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

.gauge-center-label .gauge-number {
  font-size: 2.2rem;
  font-weight: 900;
  display: block;
  letter-spacing: -0.02em;
}

.gauge-center-label .gauge-unit {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---------- Dashboard Grid ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

/* ---------- Metric Cards ---------- */
.metric-card {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  border-radius: 1px;
  opacity: 0.5;
  transition: width var(--transition-base), opacity var(--transition-base);
}

.metric-card:hover::after {
  width: 80%;
  opacity: 0.8;
}

.metric-card.accent-blue::after { background: var(--gradient-primary); }
.metric-card.accent-green::after { background: var(--gradient-success); }
.metric-card.accent-yellow::after { background: var(--gradient-warning); }
.metric-card.accent-red::after { background: var(--gradient-danger); }

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
}

.metric-icon svg {
  width: 24px;
  height: 24px;
}

.metric-icon.icon-blue { background: rgba(56, 189, 248, 0.12); color: var(--accent-blue); }
.metric-icon.icon-green { background: rgba(74, 222, 128, 0.12); color: var(--accent-green); }
.metric-icon.icon-yellow { background: rgba(250, 204, 21, 0.12); color: var(--accent-yellow); }
.metric-icon.icon-red { background: rgba(248, 113, 113, 0.12); color: var(--accent-red); }
.metric-icon.icon-purple { background: rgba(167, 139, 250, 0.12); color: var(--accent-purple); }
.metric-icon.icon-cyan { background: rgba(34, 211, 238, 0.12); color: var(--accent-cyan); }
.metric-icon.icon-pink { background: rgba(244, 114, 182, 0.12); color: var(--accent-pink); }
.metric-icon.icon-orange { background: rgba(251, 146, 60, 0.12); color: var(--accent-orange); }

.metric-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.metric-unit {
  font-size: 0.95rem;
  font-weight: 400;
  opacity: 0.6;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-status {
  margin-top: var(--space-sm);
  font-size: 0.7rem;
  font-weight: 600;
}

/* ---------- Test Sections Grid ---------- */
.tests-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.test-section {
  padding: var(--space-xl);
}

.test-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.test-section-title svg {
  width: 20px;
  height: 20px;
}

/* ---------- Speed Gauge ---------- */
.speed-gauge-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.speed-gauge {
  width: 260px;
  height: 260px;
  position: relative;
}

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

.speed-gauge .gauge-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 14;
  stroke-linecap: round;
}

.speed-gauge .gauge-progress {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.4));
}

.speed-gauge .gauge-ticks line {
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 1;
}

.speed-gauge .gauge-ticks line.major {
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 2;
}

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

.speed-center .speed-number {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  display: block;
}

.speed-center .speed-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.speed-direction-labels {
  display: flex;
  justify-content: center;
  gap: var(--space-2xl);
}

.speed-direction {
  text-align: center;
}

.speed-direction .dir-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

.speed-direction .dir-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
}

.speed-direction .dir-unit {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ---------- Test Results List ---------- */
.test-results-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.test-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.test-result-item:hover {
  background: var(--bg-glass-hover);
  border-color: var(--glass-border);
}

.test-result-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.test-result-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.test-result-name {
  font-size: 0.85rem;
  font-weight: 500;
}

.test-result-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.test-result-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: right;
}

.test-result-status {
  font-size: 0.65rem;
  font-weight: 600;
  text-align: right;
  margin-top: 2px;
}

/* ---------- Progress Bars ---------- */
.progress-bar-container {
  width: 100%;
  margin-top: var(--space-md);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: var(--space-xs);
}

.progress-label span:first-child {
  color: var(--text-secondary);
}

.progress-label span:last-child {
  font-family: var(--font-mono);
  font-weight: 600;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 20px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
  border-radius: var(--radius-full);
}

.progress-fill.fill-blue { background: var(--gradient-primary); }
.progress-fill.fill-green { background: var(--gradient-success); }
.progress-fill.fill-yellow { background: var(--gradient-warning); }
.progress-fill.fill-red { background: var(--gradient-danger); }

/* ---------- Latency Chart (Canvas) ---------- */
.chart-container {
  width: 100%;
  height: 180px;
  margin-top: var(--space-md);
  position: relative;
}

.chart-container canvas {
  width: 100%;
  height: 100%;
}

/* ---------- Main CTA Button ---------- */
.cta-section {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: 16px 48px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-sans);
  color: white;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: var(--shadow-glow-blue);
  transition: transform var(--transition-spring), box-shadow var(--transition-base), opacity var(--transition-fast);
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transition: left 0.6s ease;
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 0 40px rgba(56, 189, 248, 0.5);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary:disabled:hover::before {
  left: -100%;
}

.btn-primary svg {
  width: 22px;
  height: 22px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 24px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  background: var(--bg-glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

/* ---------- Test Controls Row ---------- */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

/* ---------- Full Width Sections ---------- */
.full-width-section {
  margin-bottom: var(--space-xl);
}

/* ---------- Detail Grid (3 columns) ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

/* ---------- Test Log / Timeline ---------- */
.test-log {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  max-height: 300px;
  overflow-y: auto;
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.test-log::-webkit-scrollbar {
  width: 4px;
}

.test-log::-webkit-scrollbar-track {
  background: transparent;
}

.test-log::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

.log-entry {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
}

.log-time {
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 70px;
}

.log-icon {
  min-width: 16px;
  font-size: 0.7rem;
  line-height: 1.6;
}

.log-msg {
  flex: 1;
}

.log-msg.success { color: var(--accent-green); }
.log-msg.warning { color: var(--accent-yellow); }
.log-msg.error { color: var(--accent-red); }
.log-msg.info { color: var(--accent-blue); }

/* ---------- Network Info Table ---------- */
.info-table {
  width: 100%;
  border-collapse: collapse;
}

.info-table tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.info-table tr:last-child {
  border-bottom: none;
}

.info-table td {
  padding: 10px 0;
  font-size: 0.85rem;
}

.info-table td:first-child {
  color: var(--text-muted);
  width: 40%;
  font-weight: 500;
}

.info-table td:last-child {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ---------- Tooltip ---------- */
.tooltip {
  position: relative;
  cursor: help;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 100;
}

.tooltip:hover::after {
  opacity: 1;
}

/* ---------- Spinner ---------- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Skeleton loading ---------- */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.04) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Fade In Animations ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
}

.fade-in-up:nth-child(1) { animation-delay: 0.05s; }
.fade-in-up:nth-child(2) { animation-delay: 0.1s; }
.fade-in-up:nth-child(3) { animation-delay: 0.15s; }
.fade-in-up:nth-child(4) { animation-delay: 0.2s; }
.fade-in-up:nth-child(5) { animation-delay: 0.25s; }
.fade-in-up:nth-child(6) { animation-delay: 0.3s; }

/* ---------- Pulse effect for running tests ---------- */
@keyframes testRunning {
  0%, 100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(56, 189, 248, 0); }
}

.test-running {
  animation: testRunning 1.5s ease-in-out infinite;
}

/* ---------- History bar mini chart ---------- */
.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 40px;
}

.mini-bar {
  width: 6px;
  border-radius: 2px 2px 0 0;
  transition: height var(--transition-base);
  min-height: 2px;
}

/* ---------- Fiber Health Section ---------- */
.fiber-health-section {
  margin-bottom: var(--space-xl);
  padding: var(--space-xl);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.06) 0%, rgba(74, 222, 128, 0.06) 50%, rgba(167, 139, 250, 0.06) 100%);
  border: 1px solid rgba(56, 189, 248, 0.15);
  position: relative;
  overflow: hidden;
}

.fiber-health-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-green), var(--accent-purple));
  opacity: 0.7;
}

.fiber-health-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.fiber-health-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.fiber-health-title svg {
  -webkit-text-fill-color: initial;
  color: var(--accent-green);
}

.fiber-metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-md);
}

.metric-sublabel {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
  opacity: 0.7;
  font-weight: 400;
}

/* ---------- Footer ---------- */
.app-footer {
  text-align: center;
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.app-footer a {
  color: var(--accent-blue);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .fiber-metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .app-container {
    padding: var(--space-md);
  }

  .app-header {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
  }

  .logo-group {
    justify-content: center;
  }

  .header-meta {
    justify-content: center;
    flex-wrap: wrap;
  }

  .score-banner {
    flex-direction: column;
    text-align: center;
    padding: var(--space-xl);
  }

  .score-desc {
    max-width: 100%;
  }

  .tests-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .fiber-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .speed-direction-labels {
    gap: var(--space-lg);
  }
}

@media (max-width: 600px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .fiber-metrics-grid {
    grid-template-columns: 1fr;
  }

  .btn-primary {
    width: 100%;
    padding: 14px 24px;
  }

  .score-value {
    font-size: 3rem;
  }

  .speed-gauge {
    width: 200px;
    height: 200px;
  }

  .speed-center .speed-number {
    font-size: 2.2rem;
  }
}

/* ---------- Language Selector ---------- */
.lang-selector-wrapper {
  position: relative;
}

.lang-selector {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 6px 28px 6px 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  max-width: 170px;
  text-overflow: ellipsis;
}

.lang-selector:hover {
  border-color: var(--accent-blue);
  background-color: var(--bg-glass-hover);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

.lang-selector:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.lang-selector option {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 8px;
}

/* ---------- RTL Support (Arabic) ---------- */
[dir="rtl"] .app-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .header-meta {
  flex-direction: row-reverse;
}

[dir="rtl"] .logo-group {
  flex-direction: row-reverse;
}

[dir="rtl"] .logo-text {
  text-align: right;
}

[dir="rtl"] .card-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .card-title {
  flex-direction: row-reverse;
}

[dir="rtl"] .test-result-item {
  flex-direction: row-reverse;
}

[dir="rtl"] .test-result-left {
  flex-direction: row-reverse;
}

[dir="rtl"] .log-entry {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .info-table td:first-child {
  text-align: right;
}

[dir="rtl"] .info-table td:last-child {
  text-align: left;
}

[dir="rtl"] .lang-selector {
  padding: 6px 10px 6px 28px;
  background-position: left 8px center;
}

[dir="rtl"] .progress-label {
  flex-direction: row-reverse;
}

[dir="rtl"] .speed-direction-labels {
  flex-direction: row-reverse;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE COMPACT VERSION — Speed & Ping Focused
   Progressive disclosure: core metrics visible, details collapsible
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {

  /* ── Base Layout ── */
  .app-container {
    padding: 6px;
    gap: 8px;
  }

  /* ── Header: Ultra-compact single row ── */
  .app-header {
    padding: 8px 10px;
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  .logo-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
  }

  .logo-text h1 {
    font-size: 0.95rem;
    white-space: nowrap;
  }

  .logo-text p {
    display: none; /* Hide subtitle on mobile — save space */
  }

  .header-meta {
    gap: 4px;
    flex-wrap: nowrap;
  }

  .header-meta-item {
    font-size: 0.6rem;
  }

  .header-meta-item svg {
    width: 11px;
    height: 11px;
  }

  /* Hide datetime on mobile — save precious header space */
  #current-datetime {
    display: none;
  }

  .theme-toggle {
    width: 28px;
    height: 28px;
    padding: 4px;
  }

  .lang-selector {
    font-size: 0.6rem;
    padding: 3px 20px 3px 5px;
    max-width: 100px;
    background-position: right 4px center;
  }

  /* ── Score Banner: Compact hero with centered gauge ── */
  .score-banner {
    padding: 12px;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
  }

  .score-info {
    order: 2;
    width: 100%;
  }

  .score-gauge-container {
    order: 1;
    width: 100px;
    height: 100px;
  }

  .gauge-number {
    font-size: 1.5rem;
  }

  .gauge-unit {
    font-size: 0.5rem;
  }

  .score-label {
    font-size: 0.65rem;
    letter-spacing: 0.05em;
  }

  .score-value-row {
    justify-content: center;
  }

  .score-value {
    font-size: 2.2rem;
  }

  .score-max {
    font-size: 0.9rem;
  }

  .score-grade {
    font-size: 0.75rem;
    padding: 3px 8px;
  }

  .score-desc {
    font-size: 0.65rem;
    line-height: 1.3;
    max-width: 280px;
    margin: 0 auto;
  }

  /* ── CTA: Full-width prominent button ── */
  .cta-section {
    gap: 6px;
  }

  .btn-primary {
    width: 100%;
    padding: 14px 16px;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    min-height: 48px; /* Touch-friendly: 48px minimum */
  }

  .btn-primary svg {
    width: 18px;
    height: 18px;
  }

  .controls-row {
    gap: 4px;
  }

  .btn-secondary {
    padding: 6px 10px;
    font-size: 0.65rem;
    min-height: 36px;
  }

  /* ── Core Metrics: 2x2 Bento Grid (speed + ping focus) ── */
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .metric-card {
    padding: 10px 8px;
    text-align: center;
  }

  .metric-icon {
    width: 28px;
    height: 28px;
    margin: 0 auto 4px;
  }

  .metric-icon svg {
    width: 14px;
    height: 14px;
  }

  .metric-value {
    font-size: 1.5rem;
    line-height: 1.1;
  }

  .metric-unit {
    font-size: 0.6rem;
  }

  .metric-label {
    font-size: 0.55rem;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .metric-sublabel {
    font-size: 0.45rem;
    display: none; /* Hide sublabels on mobile */
  }

  .metric-status {
    font-size: 0.5rem;
    padding: 1px 5px;
    margin-top: 3px;
  }

  /* ── Speed Gauge: Centered, prominent ── */
  .tests-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .test-section {
    padding: 12px;
  }

  .card-header {
    margin-bottom: 8px;
  }

  .card-title {
    font-size: 0.7rem;
    gap: 4px;
  }

  .card-title svg {
    width: 14px;
    height: 14px;
  }

  .card-badge {
    font-size: 0.5rem;
    padding: 2px 5px;
  }

  .speed-gauge-wrapper {
    gap: 8px;
  }

  .speed-gauge {
    width: 170px;
    height: 170px;
    margin: 0 auto;
  }

  .speed-center .speed-number {
    font-size: 2rem;
  }

  .speed-center .speed-unit {
    font-size: 0.6rem;
  }

  .speed-direction-labels {
    flex-direction: row;
    gap: 16px;
    justify-content: center;
  }

  .speed-direction {
    text-align: center;
  }

  .dir-label {
    font-size: 0.55rem;
  }

  .dir-value {
    font-size: 0.9rem;
    font-weight: 700;
  }

  .dir-unit {
    font-size: 0.55rem;
  }

  /* ── Latency Chart: Compact ── */
  .chart-container {
    height: 100px;
  }

  /* ── Detail Sections: Collapsed by default on mobile ── */
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .info-table td {
    padding: 5px 0;
    font-size: 0.65rem;
  }

  /* ── Fiber Health: Compact grid ── */
  .fiber-health-section {
    padding: 10px;
  }

  .fiber-health-header {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }

  .fiber-health-title {
    font-size: 0.75rem;
  }

  .fiber-health-title svg {
    width: 14px;
    height: 14px;
  }

  .fiber-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  /* ── Multi-server: Compact ── */
  .test-results-list {
    gap: 4px;
  }

  .test-result-item {
    padding: 6px 8px;
  }

  .test-result-icon {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  .test-result-name {
    font-size: 0.65rem;
  }

  .test-result-desc {
    font-size: 0.5rem;
  }

  .test-result-value {
    font-size: 0.75rem;
  }

  /* ── Log: Minimal ── */
  .test-log {
    max-height: 150px;
  }

  .log-entry {
    padding: 2px 0;
    gap: 3px;
  }

  .log-time {
    font-size: 0.5rem;
    min-width: 45px;
  }

  .log-icon {
    font-size: 0.45rem;
  }

  .log-msg {
    font-size: 0.55rem;
  }

  /* ── Footer ── */
  .app-footer {
    padding: 12px;
  }

  .app-footer p {
    font-size: 0.65rem !important;
  }

  /* ── Progress bar ── */
  .progress-label {
    font-size: 0.6rem;
  }

  .progress-track {
    height: 3px;
  }

  /* ── History bars ── */
  .mini-bars {
    height: 25px;
  }

  .mini-bar {
    min-width: 3px;
  }

  /* ── Glass card base ── */
  .glass-card {
    padding: 10px;
    border-radius: var(--radius-sm);
  }

  /* ── Animations: reduce for performance ── */
  .fade-in-up {
    animation-duration: 0.2s;
  }
}

/* ═══════════════════════════════════════════════════════════════
   EXTRA SMALL DEVICES (< 360px) — Minimal viable layout
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 360px) {
  .app-container {
    padding: 4px;
    gap: 6px;
  }

  .app-header {
    padding: 6px 8px;
  }

  .logo-text h1 {
    font-size: 0.85rem;
  }

  .logo-icon {
    width: 20px;
    height: 20px;
  }

  .lang-selector {
    max-width: 80px;
    font-size: 0.55rem;
  }

  /* Stack metrics vertically on tiny screens */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .metric-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    text-align: left;
    padding: 8px 10px;
  }

  .metric-icon {
    width: 24px;
    height: 24px;
    margin: 0;
    flex-shrink: 0;
  }

  .metric-value {
    font-size: 1.2rem;
  }

  .metric-label {
    font-size: 0.5rem;
  }

  .fiber-metrics-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .score-banner {
    padding: 10px;
  }

  .score-value {
    font-size: 1.8rem;
  }

  .score-gauge-container {
    width: 80px;
    height: 80px;
  }

  .gauge-number {
    font-size: 1.2rem;
  }

  .speed-gauge {
    width: 140px;
    height: 140px;
  }

  .speed-center .speed-number {
    font-size: 1.6rem;
  }

  .btn-primary {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .speed-direction-labels {
    flex-direction: column;
    gap: 4px;
  }
}

/* ---------- Hidden utility ---------- */
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
