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

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: #1a1a3a;
  --text-primary: #ffffff;
  --text-secondary: #8888aa;
  --accent-5g: #00f5ff;
  --accent-4g: #ff9500;
  --success: #22c55e;
  --warning: #f97316;
  --danger: #ef4444;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: linear-gradient(135deg, #2a1a4a 0%, #0a1a3a 100%);
  padding: 16px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  background: linear-gradient(90deg, #fff 0%, var(--accent-5g) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tracking-indicator {
  position: absolute;
  right: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--danger);
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

/* Main */
.main {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Gauge Section */
.gauge-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.gauge-container {
  position: relative;
  width: 200px;
  height: 200px;
}

.gauge-svg {
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease;
}

.gauge-progress {
  transition: stroke-dashoffset 0.5s ease, stroke 0.3s ease;
}

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

.gauge-percentage {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

.gauge-network {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 4px;
  color: var(--text-secondary);
}

.gauge-label {
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pulse-ring {
  animation: pulse 2s infinite;
}

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

/* Particles */
.particles-container {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  animation: particle-fly 1.5s infinite;
  animation-delay: var(--delay);
  transform: rotate(var(--angle));
}

@keyframes particle-fly {
  0% { 
    transform: rotate(var(--angle)) translateX(30px);
    opacity: 1;
  }
  100% { 
    transform: rotate(var(--angle)) translateX(80px);
    opacity: 0;
  }
}

/* Network Badge */
.network-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: 50px;
  background: var(--bg-card);
  border: 2px solid var(--badge-color);
  transition: all 0.3s ease;
}

.badge-5g {
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.3), 0 0 40px rgba(0, 245, 255, 0.1);
}

.badge-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--badge-color);
}

.stability-indicator {
  font-size: 0.8rem;
}

.stability-indicator.stable { color: var(--success); }
.stability-indicator.fluctuating { 
  color: var(--warning);
  animation: spin 1s linear infinite;
}

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

.fun-message {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--danger);
  text-align: center;
  animation: flicker 0.5s infinite;
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stats-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.05);
  transition: transform 0.2s ease;
}

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

.stats-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.stats-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stats-unit {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.stats-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Section Header */
.section-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

/* Location Section */
.location-section {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.05);
}

.mini-map {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}

.map-canvas {
  width: 100%;
  height: auto;
  display: block;
}

.map-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-align: center;
}

.coordinates {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.accuracy {
  color: var(--accent-5g);
}

/* Signal History */
.signal-history {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.05);
}

.history-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  margin-bottom: 8px;
}

.history-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 0.7rem;
}

.legend-5g::before, .legend-4g::before {
  content: '■ ';
}

.legend-5g { color: var(--accent-5g); }
.legend-4g { color: var(--accent-4g); }

/* Achievements */
.achievements-section {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.05);
}

.achievements-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.achievement {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  transition: all 0.3s ease;
}

.achievement.earned {
  background: linear-gradient(135deg, rgba(34,197,94,0.2) 0%, rgba(0,245,255,0.1) 100%);
  border: 1px solid var(--success);
}

.achievement.locked {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  opacity: 0.5;
}

.achievement-icon {
  font-size: 1rem;
}

.achievement-name {
  font-weight: 500;
}

/* Coverage Log */
.log-section {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.05);
}

.log-container {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-entry {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border-left: 3px solid;
  font-size: 0.8rem;
}

.log-time {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  font-size: 0.7rem;
}

.log-network {
  font-weight: 600;
}

.log-strength {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.log-coords {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-secondary);
}

.log-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px;
  font-size: 0.85rem;
}

/* Permission Denied */
.permission-denied {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.permission-denied span {
  font-size: 2rem;
  display: block;
  margin-bottom: 12px;
}

.permission-denied p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

/* Footer */
.footer {
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid rgba(255,255,255,0.05);
}

.footer-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.track-button {
  flex: 2;
  padding: 14px 24px;
  border: none;
  border-radius: 50px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, var(--accent-5g) 0%, #0088cc 100%);
  color: var(--bg-primary);
}

.track-button:hover {
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.4);
}

.track-button.tracking {
  background: linear-gradient(135deg, var(--danger) 0%, #cc3300 100%);
}

.secondary-button {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50px;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.secondary-button:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.3);
}

.remix-link {
  display: block;
  text-align: center;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.75rem;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.remix-link:hover {
  opacity: 1;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
}

/* Mobile optimizations */
@media (max-width: 380px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  
  .stats-card {
    padding: 12px;
  }
  
  .stats-value {
    font-size: 1.2rem;
  }
  
  .log-entry {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
  }
  
  .log-coords {
    display: none;
  }
}