:root {
  /* Colors - Deep Dark Theme */
  --bg-color: #0b0f19;
  --bg-gradient: radial-gradient(circle at 50% 10%, #161b2e 0%, #0b0f19 100%);
  --card-bg: #141824;
  --card-border: #1f2536;
  
  --primary: #00e0ff;
  --primary-glow: rgba(0, 224, 255, 0.4);
  --secondary: #6e44ff;
  --text-main: #ffffff;
  --text-muted: #8a96a8;
  --success: #00ff9d;
  --danger: #ff4455;

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

  /* Spacing */
  --container-width: 1200px;
  --header-height: 70px;
}

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

body {
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Typography Utilities */
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; }
.text-gradient {
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Layout */
.container {
  width: 90%;
  max-width: var(--container-width);
  margin: 0 auto;
}

nav {
  height: var(--header-height);
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
  position: fixed;
  top: 0; 
  width: 100%;
  z-index: 100;
}

nav .logo { font-size: 1.5rem; font-weight: 900; color: var(--primary); display: flex; align-items: center; gap: 10px; }

main { flex: 1; margin-top: var(--header-height); padding: 40px 0; display: flex; align-items: center; justify-content: center; position: relative; }

/* Views System */
.view { display: none; width: 100%; animation: fadeUp 0.5s ease; }
.view.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- HOME VIEW --- */
.hero-section { text-align: center; }

.go-button-container {
  width: 280px;
  height: 280px;
  margin: 60px auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.go-button {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(0,0,0,0.3);
  border: 4px solid var(--primary);
  color: var(--text-main);
  font-size: 4rem;
  font-weight: 900;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 0 30px var(--primary-glow);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.go-button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 60px var(--primary-glow);
  background: rgba(0, 224, 255, 0.1);
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px solid var(--primary);
  border-radius: 50%;
  opacity: 0;
  animation: pulse 3s infinite;
}
.pulse-ring:nth-child(2) { animation-delay: 1s; }

@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0; }
  50% { opacity: 0.3; }
  100% { transform: scale(1.4); opacity: 0; }
}

.meta-info {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  text-align: left;
}
.meta-card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 15px;
}
.meta-icon { font-size: 1.5rem; color: var(--muted); }
.meta-text span { display: block; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; }
.meta-text strong { font-size: 1.1rem; }

/* --- ACTIVE TEST VIEW --- */
.active-dashboard {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  max-width: 1000px;
  margin: 0 auto;
}
@media (max-width: 768px) { .active-dashboard { grid-template-columns: 1fr; } }

.gauge-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 40px;
  border: 1px solid var(--card-border);
  text-align: center;
  position: relative;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.top-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 30px;
  position: absolute;
  top: 20px;
  width: 100%;
  left: 0;
}
.stat-mini h4 { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 5px; }
.stat-mini .value { font-size: 1.5rem; font-family: var(--font-mono); }

.gauge-container {
  position: relative;
  width: 300px;
  height: 150px;
  margin: 0 auto;
  overflow: hidden;
}
.gauge-bg, .gauge-progress {
  width: 100%;
  height: 300px;
  border-radius: 50%;
  border: 20px solid #1f2536;
  position: absolute;
  top: 0; left: 0;
  box-sizing: border-box;
}
.gauge-progress {
  border-color: transparent;
  border-top-color: var(--primary);
  border-right-color: var(--secondary);
  transform: rotate(-135deg); /* Start position */
  transition: transform 0.2s linear;
}

.speed-display {
  margin-top: 20px;
}
.speed-value {
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
}
.speed-unit {
  color: var(--primary);
  font-weight: 600;
  font-size: 1.2rem;
}

.graph-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid var(--card-border);
}
canvas#liveGraph {
  width: 100%;
  height: 100%;
}

/* --- RESULTS VIEW --- */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}

.result-main-card {
  grid-column: span 1;
  background: var(--card-bg);
  padding: 30px;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  position: relative;
  overflow: hidden;
}
.result-main-card::after {
  content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--primary);
}
.result-main-card.upload::after { background: var(--secondary); }

.result-label { color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; font-size: 0.9rem; margin-bottom: 10px; }
.result-val { font-size: 4rem; font-weight: 800; }

.secondary-stats-row {
  grid-column: span 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}
.stat-box { background: rgba(255,255,255,0.03); padding: 15px; border-radius: 8px; }

.footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 40px;
}
.footer a { color: var(--text-muted); text-decoration: none; margin: 0 10px; }
.footer a:hover { color: var(--primary); }

/* Utilities */
.hidden { display: none !important; }
