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

html, body, #app {
  height: 100%;
  width: 100%;
  font-family: system-ui, sans-serif;
}

.leaflet-container {
  cursor: pointer !important;
}

#app {
  position: relative;
  display: flex;
  flex-direction: column;
}

#map {
  flex: 1;
  width: 100%;
}

/* Suburb name card — top center, over map */
#suburb-card {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(20, 20, 30, 0.82);
  backdrop-filter: blur(6px);
  color: #fff;
  padding: 10px 24px;
  border-radius: 12px;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

/* Action bar — bottom center, over map */
#action-bar {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#submit-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 14px 36px;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

#submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#submit-btn:not(:disabled):hover {
  background: #1d4ed8;
}

#skip-btn {
  background: none;
  color: rgba(255, 255, 255, 0.75);
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

#skip-btn:hover {
  color: #fff;
}

#skip-btn:disabled {
  opacity: 0;
  pointer-events: none;
}

/* Result overlay */
#result-overlay {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  margin-bottom: 24px;
  min-width: 280px;
}

#result-overlay[hidden] {
  display: none;
}

#result-content {
  background: rgba(20, 20, 30, 0.9);
  backdrop-filter: blur(8px);
  color: #fff;
  border-radius: 16px;
  padding: 20px 28px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#result-distance {
  font-size: 1.15rem;
  font-weight: 600;
  color: #86efac;
}

#next-btn {
  margin-top: 10px;
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 10px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

#next-btn:hover {
  background: #1d4ed8;
}

/* Stats link — top right, over map */
#stats-link {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1000;
  background: rgba(20, 20, 30, 0.82);
  backdrop-filter: blur(6px);
  color: #fff;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  transition: background 0.15s;
}

#stats-link:hover {
  background: rgba(37, 99, 235, 0.85);
}

/* Stats page */
.stats-page {
  background: #0f1117;
  color: #e2e8f0;
  min-height: 100%;
}

#stats-app {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

#stats-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

#stats-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
}

.nav-link {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
  white-space: nowrap;
}

.nav-link:hover {
  color: #fff;
}

#stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

#stats-table th {
  text-align: left;
  padding: 10px 16px;
  color: #64748b;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #1e293b;
}

#stats-table td {
  padding: 11px 16px;
  border-bottom: 1px solid #1e293b;
}

#stats-table tbody tr:hover td {
  background: #1e293b;
}

#stats-table th:not(:first-child),
#stats-table td:not(:first-child) {
  text-align: right;
}

.empty {
  color: #475569;
  text-align: center !important;
  padding: 32px !important;
}
