:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #ebe7de;
  color: #202326;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  height: 100vh;
  min-height: 640px;
}

.map-shell {
  position: relative;
  min-width: 0;
  background: #ccd5cd;
}

#map {
  position: absolute;
  inset: 0;
}

.leaflet-container {
  width: 100%;
  height: 100%;
  font: inherit;
}

.media-marker-icon {
  border: 0;
  background: transparent;
}

.topbar {
  position: absolute;
  z-index: 2;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.topbar > div,
.toolbar {
  pointer-events: auto;
}

.topbar > div:first-child {
  max-width: 440px;
  padding: 14px 16px;
  border: 1px solid rgba(32, 35, 38, 0.12);
  border-radius: 8px;
  background: rgba(251, 250, 247, 0.94);
  box-shadow: 0 18px 48px rgba(32, 35, 38, 0.12);
  backdrop-filter: blur(10px);
}

.topbar p {
  margin: 0 0 4px;
  color: #8b3b2f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.08;
}

.toolbar {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(32, 35, 38, 0.12);
  border-radius: 8px;
  background: rgba(251, 250, 247, 0.94);
  box-shadow: 0 18px 48px rgba(32, 35, 38, 0.12);
  backdrop-filter: blur(10px);
}

.toolbar button,
.timeline button,
.tag-list button,
.chips button {
  border: 1px solid rgba(32, 35, 38, 0.14);
  border-radius: 7px;
  background: #ffffff;
  color: #202326;
  font-weight: 750;
}

.toolbar button {
  min-width: 70px;
  height: 34px;
}

.toolbar button[aria-pressed="true"] {
  border-color: #2f5f7c;
  background: #2f5f7c;
  color: #ffffff;
}

.timeline-shell {
  position: absolute;
  z-index: 2;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(32, 35, 38, 0.12);
  border-radius: 8px;
  background: rgba(251, 250, 247, 0.94);
  box-shadow: 0 18px 48px rgba(32, 35, 38, 0.14);
  backdrop-filter: blur(10px);
}

.timeline-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #667075;
  font-size: 13px;
  font-weight: 750;
}

[data-state="ok"] {
  color: #1f7a4d;
}

[data-state="warn"] {
  color: #9b6928;
}

[data-state="error"] {
  color: #a3312a;
}

.timeline {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.timeline button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  min-width: 88px;
  height: 38px;
  padding: 0 10px;
  white-space: nowrap;
}

.timeline button strong {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #efe9dc;
  color: #684b2f;
  font-size: 12px;
}

.timeline button.is-active {
  border-color: #8b3b2f;
  background: #8b3b2f;
  color: #ffffff;
}

.timeline button.is-active strong {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.side-panel {
  display: grid;
  grid-template-rows: auto 245px minmax(0, 1fr);
  min-width: 0;
  height: 100vh;
  border-left: 1px solid rgba(32, 35, 38, 0.12);
  background: #fbfaf7;
}

.search-block {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-bottom: 1px solid rgba(32, 35, 38, 0.1);
}

.search-block label {
  color: #667075;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.search-block input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(32, 35, 38, 0.14);
  border-radius: 8px;
  background: #ffffff;
  color: #202326;
}

.chips,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chips button,
.tag-list button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.nearby-places {
  display: grid;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(32, 35, 38, 0.12);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.section-heading span {
  color: #667075;
  font-size: 12px;
  font-weight: 750;
}

.places-list {
  display: grid;
  gap: 8px;
}

.place-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(32, 35, 38, 0.12);
  border-radius: 8px;
  background: #ffffff;
  color: inherit;
  text-decoration: none;
}

.place-row:hover {
  border-color: rgba(47, 95, 124, 0.45);
}

.place-number {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #2f5f7c;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.place-content {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.place-content strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place-content small,
.empty-places {
  color: #667075;
  font-size: 12px;
  line-height: 1.35;
}

.empty-places {
  margin: 0;
  padding: 10px;
  border: 1px dashed rgba(32, 35, 38, 0.16);
  border-radius: 8px;
}

.media-preview {
  position: relative;
  min-height: 0;
  background: #1e2529;
}

.media-preview img,
.media-preview video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.side-panel[data-empty="true"] .media-preview {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(47, 95, 124, 0.18), transparent),
    #d8d0c3;
}

.video-preview-badge {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 7px 9px;
  border-radius: 7px;
  background: rgba(139, 59, 47, 0.92);
  color: #ffffff;
  font-size: 12px;
  font-weight: 850;
}

.media-detail {
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
}

.media-location {
  margin: 0 0 8px;
  color: #8b3b2f;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.media-detail h2 {
  font-size: 24px;
  line-height: 1.12;
}

.media-meta {
  margin: 10px 0 0;
  color: #667075;
  font-size: 14px;
  font-weight: 700;
}

.media-description {
  margin: 18px 0;
  color: #333a3f;
  font-size: 15px;
  line-height: 1.5;
}

.map-marker {
  position: relative;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 3px solid #ffffff;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(32, 35, 38, 0.32);
}

.map-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -11px;
  width: 14px;
  height: 14px;
  border-right: 3px solid #ffffff;
  border-bottom: 3px solid #ffffff;
  background: #ffffff;
  transform: translateX(-50%) rotate(45deg);
}

.map-marker img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  object-fit: cover;
}

.map-marker span {
  position: absolute;
  z-index: 2;
  right: -7px;
  top: -8px;
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 18px;
  padding: 0 5px;
  border-radius: 6px;
  background: #2f5f7c;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
}

.map-marker.is-video span {
  background: #8b3b2f;
}

.map-marker.is-selected {
  border-color: #f0ba4f;
  box-shadow: 0 0 0 4px rgba(240, 186, 79, 0.4), 0 16px 34px rgba(32, 35, 38, 0.36);
}

@media (max-width: 860px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .map-shell {
    height: 62vh;
    min-height: 430px;
  }

  .side-panel {
    grid-template-rows: auto 240px auto;
    height: auto;
    border-left: 0;
    border-top: 1px solid rgba(32, 35, 38, 0.12);
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    width: max-content;
  }

  .timeline-shell {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }
}
