/* web/style.css */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  background: #000;
  overflow: hidden;
}

#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── Glass control panel ── */
#panel {
  position: fixed;
  top: 14px;
  left: 14px;
  width: 300px;
  z-index: 20;
  background: rgba(28, 28, 30, 0.55);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #fff;
}

#panel-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: #fff;
}

#panel-title::after {
  content: ' 〜';
  opacity: 0.5;
  font-weight: 300;
}

.hint {
  font-size: 13px;
  color: rgba(235, 235, 245, 0.6);
  line-height: 1.45;
}

.hint strong {
  color: rgba(235, 235, 245, 0.85);
  font-weight: 500;
}

#btn-find {
  background: #0A84FF;
  border: none;
  color: #fff;
  padding: 11px 0;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  width: 100%;
  transition: background 0.15s ease;
}

#btn-find:hover:not(:disabled) {
  background: #409CFF;
}

#btn-find:disabled {
  background: rgba(120, 120, 128, 0.32);
  cursor: not-allowed;
  color: rgba(235, 235, 245, 0.4);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: rgba(235, 235, 245, 0.85);
}

.filter-row input[type=checkbox] {
  accent-color: #0A84FF;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.filter-row label {
  cursor: pointer;
  user-select: none;
}

/* ── Status line ── */
#status-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 1.3em;
}

#status {
  font-size: 13px;
  color: rgba(235, 235, 245, 0.7);
  line-height: 1.4;
}

#status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0A84FF;
  flex-shrink: 0;
  animation: pulse-dot 1.2s ease-in-out infinite;
}

#status-dot.hidden {
  display: none;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

/* ── Basemap toggle pill ── */
#basemap-toggle {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  background: rgba(28, 28, 30, 0.55);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  border-radius: 50px;
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: rgba(235, 235, 245, 0.7);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  padding: 6px 18px;
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.seg-btn.active {
  background: rgba(255, 255, 255, 0.9);
  color: #1c1c1e;
  font-weight: 600;
}

.seg-btn:not(.active):hover {
  color: rgba(235, 235, 245, 0.95);
}

/* ── Custom start / finish markers ── */
.custom-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: default;
}

.marker-label {
  background: rgba(28, 28, 30, 0.6);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 50px;
  border: 0.5px solid rgba(255, 255, 255, 0.18);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.1px;
}

.marker-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
}

.marker-dot.start { background: #30D158; }
.marker-dot.finish { background: #FF453A; }

/* ── Popup overrides ── */
.maplibregl-popup-content {
  background: rgba(28, 28, 30, 0.82);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 14px;
  padding: 14px;
  max-width: 260px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.maplibregl-popup-tip {
  display: none;
}

.maplibregl-popup-close-button {
  color: rgba(235, 235, 245, 0.5);
  font-size: 16px;
  top: 8px;
  right: 10px;
}

.maplibregl-popup-close-button:hover {
  color: rgba(235, 235, 245, 0.9);
  background: transparent;
}

.popup-score {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  margin-bottom: 2px;
}

.popup-score span {
  font-size: 14px;
  font-weight: 400;
  color: rgba(235, 235, 245, 0.5);
}

.popup-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255, 214, 10, 0.18);
  color: #FFD60A;
  border-radius: 6px;
  padding: 2px 7px;
  margin-top: 6px;
}

.popup-crop {
  width: 100%;
  border-radius: 8px;
  margin-top: 10px;
  display: block;
}

.popup-breakdown {
  font-size: 12px;
  color: rgba(235, 235, 245, 0.55);
  margin-top: 8px;
  line-height: 1.65;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 12px;
}

.popup-breakdown b {
  color: rgba(235, 235, 245, 0.8);
  font-weight: 500;
}

.popup-no-img {
  font-size: 11px;
  color: rgba(235, 235, 245, 0.35);
  margin-top: 6px;
  font-style: italic;
}
