:root {
  --primary-color: #7a1f2b;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Splash screen */
.splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-color);
  color: #fff;
  text-align: center;
  padding: 2rem;
}

.splash-content {
  max-width: 32rem;
}

.splash-content h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.splash-content p {
  opacity: 0.9;
  margin-bottom: 2rem;
}

#splash-start {
  padding: 0.9rem 2rem;
  font-size: 1rem;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: var(--primary-color);
  cursor: pointer;
}

.lang-toggle {
  display: block;
  margin: 1rem auto 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: #fff;
  border-radius: 999px;
  padding: 0.6rem 1.1rem;
  min-height: 44px;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Location permission primer */
.location-primer {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  padding: 1.5rem;
}

.location-primer[hidden] {
  display: none;
}

.location-primer-content {
  background: #fff;
  border-radius: 1rem;
  padding: 1.75rem;
  max-width: 26rem;
  text-align: center;
}

.location-primer-content h2 {
  margin-top: 0;
}

.location-primer-content button {
  margin-top: 1rem;
  padding: 0.75rem 1.75rem;
  border: none;
  border-radius: 999px;
  background: var(--primary-color);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

/* Map */
.map-view {
  position: fixed;
  inset: 0;
}

#map {
  width: 100%;
  height: 100%;
}

.map-lang-toggle {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  z-index: 1000;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 0.6rem 1.1rem;
  min-height: 44px;
  font-size: 0.85rem;
  cursor: pointer;
}

.gps-status {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  z-index: 1000;
  max-width: 90%;
  text-align: center;
}

.poi-marker-dot {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--primary-color);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.poi-marker-visited .poi-marker-dot {
  background: #2e7d32;
}

.poi-marker-visited .poi-marker-dot::after {
  content: "\2713";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.7rem;
}

/* Map FAB controls (recenter / poi list / compass) */
.map-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.map-fab {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: #333;
  font-size: 1.2rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compass-fab {
  position: relative;
}

.compass-arrow {
  display: inline-block;
  transition: transform 0.2s linear;
}

/* POI list panel (fallback when GPS is slow to trigger the modal) */
.poi-list-panel {
  position: absolute;
  top: 1rem;
  right: 4rem;
  z-index: 1000;
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  width: 16rem;
  max-height: 70vh;
  overflow-y: auto;
}

.poi-list-panel[hidden] {
  display: none;
}

.poi-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
}

.poi-list-header h3 {
  margin: 0;
  font-size: 1rem;
}

.poi-list-close {
  border: none;
  background: none;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.poi-list-items {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
}

.poi-list-items li {
  padding: 0.6rem 0.5rem;
  border-radius: 0.4rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.poi-list-items li:hover {
  background: #f5f5f4;
}

.poi-list-items .poi-list-distance {
  color: #777;
  white-space: nowrap;
}

.poi-list-empty {
  padding: 1rem;
  color: #777;
  font-size: 0.9rem;
  text-align: center;
}

.user-marker-dot {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #1a73e8;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.accuracy-circle {
  fill: #1a73e8;
  fill-opacity: 0.12;
  stroke: #1a73e8;
  stroke-opacity: 0.4;
}

/* POI player footer — deliberately NOT a full-screen overlay: the map
   behind it must stay visible, pannable and tappable (other markers included)
   while a track plays, instead of being dimmed/blocked by a modal backdrop. */
.poi-modal {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1600;
  pointer-events: none; /* only .poi-modal-content itself should catch clicks */
}

/* `.splash` sets display:flex unconditionally, which ties in specificity
   with the browser's default `[hidden] { display: none }` — at a tie,
   author CSS wins, so the plain `hidden` attribute alone would be silently
   ignored and it would stay visible. This rule breaks the tie explicitly.
   `.poi-modal` doesn't need it: it has no conflicting `display` of its own,
   so `[hidden]` already works. */
.splash[hidden] {
  display: none;
}

.poi-modal-content {
  pointer-events: auto;
  position: relative;
  background: #fff;
  width: 100%;
  max-height: 42vh;
  overflow-y: auto;
  border-radius: 1rem 1rem 0 0;
  padding: 1.5rem;
  margin: 0 auto;
  max-width: 40rem;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
}

.poi-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.audio-player {
  margin-top: 1.5rem;
}

.audio-controls {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  align-items: center;
}

.audio-controls button {
  border: none;
  background: var(--primary-color);
  color: #fff;
  border-radius: 999px;
  width: 3rem;
  height: 3rem;
  font-size: 1rem;
  cursor: pointer;
}

.audio-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: #555;
}

.audio-progress input[type="range"] {
  flex: 1;
}
