:root {
  --ink: #f5f5f5;
  --accent: #ffe600;
  --accent-pink: #ff2ea6;
  --accent-green: #6cff2a;
}

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

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: #000;
  color: var(--ink);
}

.app {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 320px 1fr;
  position: relative;
}

.location-panel {
  background: #080808;
  border-right: 1px solid #1f1f1f;
  padding: 14px 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.location-panel-header {
  padding: 0 4px 10px;
  border-bottom: 1px solid #1f1f1f;
}

.location-panel-header h2 {
  margin: 0;
  font-size: 16px;
}

.location-panel-meta {
  margin: 6px 0 0;
  font-size: 12px;
  color: #cbcbcb;
  display: flex;
  justify-content: space-between;
}

.location-trail {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
}

.trail-btn {
  border: 0;
  background: transparent;
  color: #cbcbcb;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

.trail-btn:hover {
  color: #fff;
}

.trail-btn.is-active {
  color: var(--accent);
  cursor: default;
}

.trail-sep {
  color: #777;
}

.location-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  overflow: auto;
}

.location-list li {
  border-radius: 8px;
  border: 1px solid #1f1f1f;
  background: #111;
  overflow: hidden;
}

.location-list li + li {
  margin-top: 8px;
}

.location-list-button {
  width: 100%;
  border: 0;
  padding: 10px 8px;
  text-align: left;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.location-list-button:hover {
  background: #171717;
}

.location-list-button.is-active {
  background: #1a1a1a;
}

.location-list-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.location-item-actions {
  margin: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.location-item-actions a {
  display: inline-block;
  text-align: center;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #2c2c2c;
  background: #131313;
  color: #fff;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
}

.location-item-actions a.disabled {
  pointer-events: none;
  opacity: 0.45;
}

.location-item-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.location-item-sub {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #cbcbcb;
}

.location-empty {
  padding: 12px 8px;
  font-size: 13px;
  color: #cbcbcb;
}

.mobile-list-toggle {
  display: none;
}

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

.map-status {
  position: absolute;
  top: 12px;
  left: 50px;
  z-index: 900;
  max-width: min(560px, calc(100% - 72px));
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #2c2c2c;
  background: rgba(17, 17, 17, 0.9);
  color: #f5f5f5;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.map-status.is-success {
  border-color: #2f7f38;
}

.map-status.is-error {
  border-color: #8f2c2c;
  color: #ffd8d8;
}

.popup-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.popup-actions a {
  display: inline-block;
  text-align: center;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #2c2c2c;
  background: #131313;
  color: #fff;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
}

.popup-actions a.disabled {
  pointer-events: none;
  opacity: 0.45;
}

.leaflet-container {
  background: #0b0b0b;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #111;
  color: #fff;
  border: 1px solid #2a2a2a;
}

.leaflet-popup-content a {
  color: #fff;
}

.marker-pin {
  width: 28px;
  height: 28px;
  border-radius: 6px 6px 12px 12px;
  background: linear-gradient(135deg, var(--accent) 0%, #ffb700 100%);
  border: 2px solid #111;
  box-shadow: 0 6px 14px rgba(255, 230, 0, 0.35);
  position: relative;
}

.marker-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 10px;
  height: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #ffb700 100%);
  transform: translateX(-50%) rotate(45deg);
  border-right: 2px solid #111;
  border-bottom: 2px solid #111;
}

.marker-pin .dot {
  position: absolute;
  inset: 7px;
  border-radius: 999px;
  background: #111;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.custom-state {
  position: relative;
}

.state-icon-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(255, 230, 0, 0.35));
}

.state-badge {
  position: absolute;
  left: 34px;
  top: -6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #111;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(255, 230, 0, 0.2);
}

.marker-cluster {
  background: transparent;
}

.marker-cluster div {
  background: #111;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(255, 230, 0, 0.25);
}

.marker-cluster-small div {
  border-color: var(--accent);
  color: var(--accent);
}

.marker-cluster-medium div {
  border-color: var(--accent-pink);
  color: var(--accent-pink);
}

.marker-cluster-large div {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

@media (max-width: 860px) {
  .app {
    display: block;
  }

  #map {
    height: 100%;
  }

  .location-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    overflow: visible;
    border-right: 0;
    border-top: 1px solid #1f1f1f;
    border-radius: 14px 14px 0 0;
    max-height: 70vh;
    min-height: 48vh;
    transform: translateY(calc(100% - 70px));
    transition: transform 180ms ease;
    box-shadow: 0 -18px 30px rgba(0, 0, 0, 0.45);
  }

  .app.has-mobile-list-open .location-panel {
    transform: translateY(0);
  }

  .mobile-list-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 12px;
    top: -44px;
    z-index: 1200;
    border: 1px solid #111;
    border-radius: 999px;
    background: var(--accent);
    color: #111;
    font-size: 12px;
    font-weight: 700;
    height: 36px;
    min-width: 64px;
    padding: 0 14px;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.45);
    transition: background 120ms ease;
  }

  .mobile-list-toggle:hover {
    background: #fff06a;
  }

  .mobile-list-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
}
