
body {
  margin: 0;
  height: 100dvh;   /* modern dynamic viewport */

  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}


.map svg {
  width: 90vw;
  height: auto;          /* IMPORTANT */
  max-height: 90vh;

  background: rgba(0, 0, 0, 0.6); /* dark, 60% opacity */
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);

  opacity: 0;
  animation: fadeIn 0.5s ease forwards;

  z-index: 5;
}


.controls {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);

  display: flex;
  gap: 18px;
  align-items: center;

  padding: 14px 22px;
  border-radius: 14px;

  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  color: white;
  font-family: sans-serif;

  opacity: 0;
  animation: fadeIn 0.5s ease forwards;

  z-index: 10;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.controls button {
  min-width: 110px;
  padding: 8px 16px;
  font-size: 0.9rem;
  background: white;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
}

.stats {
  display: flex;
  gap: 16px;
  min-width: 150px;
}

#bigDistance {
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.4));

  position: fixed;
  top: 15%;
  left: 50%;
  transform: translate(-50%, -50%);

  font-size: 100px;
  opacity: 0.9;

  color: white;
  text-align: center;

  text-shadow: 0 0 12px rgba(0,0,0,0.6);

  pointer-events: none;   /* doesn't block clicks */
}

#coveredDistance {
  font-size: 100px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

#totalDistance {
  font-size: 20px;
  color: rgba(255,255,255,0.7);
}


#speed {
  width: 50px;
}


#route {
  stroke: #ff2d2d;
  stroke-width: 3;
  fill: none;

  filter: drop-shadow(0 0 12px rgba(255, 50, 50, 0.8));

}

.bg {
  position: fixed;
  inset: 0;

  background:
    linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3)),
    url("bandeira.svg");

  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;

  z-index: -1;

  animation: slowZoom 5s infinite alternate ease-in-out;

  will-change: transform;

}

@keyframes slowZoom {
  0% {
    transform: scale(1) translate(0%, 0%);
  }
  100% {
    transform: scale(1.10) translate(0%, 0%);
  }
}

.container {
  position: relative;
}

.desktopText {
  position: absolute;
  top: 20px;
  left: 20px;

  color: white;
  font-family: sans-serif;

  text-shadow: 0 0 8px rgba(0,0,0,0.6);
 
  display: flex;
  flex-direction: column;
  gap: 12px;

  opacity: 0;
  animation: fadeInText 1s ease forwards;

  z-index: 10
}

@media (max-width: 768px) {
  .desktopText {
    display: none;
  }
}

@keyframes fadeInText {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topButtons {
  top: 20px;
  right: 20px;

  display: flex;
  gap: 12px;

  z-index: 50;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 6px 12px;
  border-radius: 6px;

  font-size: 13px;
  font-weight: 500;

  text-decoration: none;
  color: white;

  border: 1px solid black;
}

.completed #route {
  stroke: #00ff88;
  filter: drop-shadow(0 0 20px #00ff88);
  transition: stroke 0.6s ease, filter 0.6s ease;
}

.completed #coveredDistance {
  animation: pulseFinish 0.8s ease;
}

@keyframes pulseFinish {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.oddVertex {
  fill: yellow;
  stroke: black;
  stroke-width: 1;
  opacity: 0;
  r: 3;
  animation: fadeOdd 0.8s ease forwards;
}

@keyframes fadeOdd {
  to {
    opacity: 1;
  }
}

.matchingPath {
  stroke: #00bfff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;

  opacity: 0;
  animation: fadeMatching 1s ease forwards;
}

@keyframes fadeMatching {
  to {
    opacity: 1;
  }
}

.mobileStrava {
  position: fixed;
  bottom: 20px;
  left: 20px;

  width: 48px;
  height: 48px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #FC4C02;   /* official Strava orange */
  border-radius: 12px;

  box-shadow: 0 6px 18px rgba(0,0,0,0.3);

  z-index: 50;
}


.mobileStrava img {
  width: 22px;
  height: 22px;
}


@media (min-width: 769px) {
  .mobileStrava {
    display: none;
  }
}

.mobileStrava:active {
  transform: scale(0.92);
}

.mobileStrava {
  box-shadow:
    0 6px 18px rgba(0,0,0,0.3),
    0 0 12px rgba(252,76,2,0.6);
}

#runner {
  opacity: 0;
}

#runner.active {
  opacity: 1;
}

:root {
  --matching-color: #00bfff;
}

.matchingText {
  color: var(--matching-color);
  font-weight: 600;
}


@media (max-width: 768px) {

#coveredDistance {
		font-size: clamp(40px, 10vw, 100px);
	}

    .controls button {
		font-size: 0.9rem;
		justify-content: center;
		gap: 12px;
	}

  .controls {
	  bottom: 30px;
    flex-wrap: wrap;
	 transform: translateX(-50%) scale(0.8);
  }

  .controls button {
    flex: 1 1 45%;
  }

  #progress {
    flex: 1 1 100%;
  }

}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}
