:root {
  --bg: #f7fafc;
  --panel: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #113c4c;
  --accent-2: #38acbd;

  --success: #0f9d58;
  --error: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 18px 48px;
}

.wrap {
  width: min(1200px, 100%);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: #ecfeff;
  padding: 12px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin: 0 0 8px;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 40px);
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 520px;
}

.btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 0;
  align-self: flex-start;
}

button {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
  box-shadow: 0 10px 25px rgba(14, 165, 233, 0.25);
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }

button.need-auth {
  animation: authPulse 1.8s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(56, 172, 189, 0.55);
}

.btn-strava {
  background: transparent;
  padding: 0;
  border-radius: 999px;
  overflow: hidden;
}

.btn-strava img {
  display: block;
  height: 40px;
  width: auto;
  max-width: 100%;
}

.btn-strava.need-auth {
  animation: authPulse 1.8s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(56, 172, 189, 0.55);
}

.btn-logout {
  min-width: 160px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 15px 50px rgba(15, 23, 42, 0.08);
}

.controls {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
}

.range-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.date-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
}

.date-field span {
  margin-left: 6px;
}

.date-input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  background: #f8fafc;
  color: var(--text);
  cursor: pointer;
  width: 120px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.date-input:focus {
  outline: none;
  border-color: rgba(56, 172, 189, 0.7);
  box-shadow: 0 0 0 1px rgba(56, 172, 189, 0.35);
}

.date-input::-webkit-calendar-picker-indicator {
  display: none;
}

.date-range-anchor {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.quick-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  align-self: flex-end;
  margin-left: auto;
  padding-left: 24px;
}

.quick-buttons button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  padding: 8px 14px;
  box-shadow: none;
}

.quick-buttons button.active {
  border-color: var(--accent);
  color: var(--accent);
}

.overview {
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
}

.label {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin: 0 0 6px;
}

.value {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.map-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.map-style-card {
  margin-left: auto;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
}

.map-style-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
}

.map-style-label {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.map-style-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-style-buttons button {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.map-style-buttons button:hover {
  border-color: rgba(15, 23, 42, 0.25);
  color: var(--text);
}

.map-style-buttons button.active {
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.3);
  background: rgba(15, 23, 42, 0.04);
}

.map-wrapper {
  position: relative;
}

#map {
  width: 100%;
  height: clamp(420px, 60vh, 640px);
  border-radius: 18px;
  overflow: hidden;
}

.map-overlay-spinner,
.map-overlay-message {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: none;
}

.map-overlay-spinner {
  top: 45%;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 700ms linear infinite;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
  z-index: 2;
}

.map-overlay-message {
  bottom: 20px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 13px;
  z-index: 2;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.map-overlay-spinner:not([hidden]),
.map-overlay-message:not([hidden]) {
  display: block;
}

.activities-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.activities-header h2 {
  margin: 0;
}

.muted {
  color: var(--muted);
}

ul {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

li {
  list-style: none;
  margin: 0;
  padding: 0;
}

li.muted {
  padding: 24px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  color: var(--muted);
  text-align: center;
  background: rgba(15, 23, 42, 0.02);
}

.activity-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.06);
}

.activity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.activity-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.activity-name {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.activity-meta {
  margin: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

.activity-meta span[aria-hidden="true"] {
  color: rgba(15, 23, 42, 0.2);
}

.activity-type {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: rgba(17, 60, 76, 0.08);
  padding: 3px 10px;
  border-radius: 999px;
}

.activity-date {
  color: var(--muted);
}

.activity-strava-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(252, 76, 2, 0.3);
  color: var(--text);
  background: rgba(252, 76, 2, 0.08);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.activity-strava-link i {
  color: #fc4c02;
  font-size: 16px;
}

.activity-strava-link:hover {
  box-shadow: 0 10px 25px rgba(252, 76, 2, 0.2);
  transform: translateY(-1px);
}

.activity-strava-link:active {
  transform: translateY(0);
}

.activity-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.activity-stat {
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(15, 23, 42, 0.02);
}

.stat-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.pagination-controls {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-controls span {
  font-size: 13px;
  color: var(--muted);
}

.pagination-controls button {
  background: transparent;
  border: 1px solid var(--border);
  padding: 0;
  box-shadow: none;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--text);
}

.pagination-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.footer-divider {
  width: min(1200px, 100%);
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0 0;
}

.site-footer {
  margin-top: 32px;
  padding: 24px 18px 32px;
  background: transparent;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  width: min(1200px, 100%);
}

.footer-content {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

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

.cookie-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 32px));
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.cookie-banner[hidden] {
  display: none;
}

.cookie-banner-text p {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

.cookie-banner-text a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.cookie-banner-text a:hover {
  text-decoration: underline;
}

.cookie-banner-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.cookie-banner button {
  flex: 0 1 150px;
}

.cookie-banner a {
  flex: 0 1 160px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.cookie-banner button.ghost,
.cookie-banner a.ghost {
  background: transparent;
  border: 1px solid rgba(15, 23, 42, 0.1);
  color: var(--text);
  box-shadow: none;
}

.cookie-banner button.ghost:hover,
.cookie-banner a.ghost:hover {
  border-color: rgba(15, 23, 42, 0.3);
}

@media (max-width: 700px) {
  body { padding: 24px 12px; }
  .controls { flex-direction: column; align-items: flex-start; }
  .overview { width: 100%; justify-content: space-between; }
  #map { height: 60vh; }
  li { align-items: stretch; }
  .activity-main { flex-direction: column; align-items: flex-start; }
  .activity-stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
}

.maplibregl-ctrl-group {
  border-radius: 999px !important;
  overflow: hidden;
  box-shadow: none;
  background: transparent;
  border: 1px solid rgba(15, 23, 42, 0.15);
}

.maplibregl-ctrl-group button {
  width: 34px;
  height: 34px;
  border: none;
  padding: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}


.maplibregl-ctrl-group button:hover {
  background: rgba(15, 23, 42, 0.08);
}

.maplibregl-ctrl-group button:active {
  background: rgba(15, 23, 42, 0.15);
}

.maplibregl-ctrl-compass {
  background: transparent !important;
}

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

@keyframes authPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(254, 199, 176, 0.45);
  }
  70% {
    box-shadow: 0 0 0 22px rgba(254, 131, 79, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(252, 76, 2, 0);
  }
}
