* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif; }
body { display: flex; height: 100vh; width: 100vw; overflow: hidden; background: #000; position: relative; }

/* Sidebar Toggle Button (Frosted Glass Pill) */
#sidebar-toggle {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2500;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(28, 28, 30, 0.88);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  transition: background 0.2s ease, transform 0.2s ease;
}
#sidebar-toggle:hover {
  background: rgba(44, 44, 46, 0.98);
  transform: scale(1.05);
}

/* Sidebar Styling & Smooth Animations */
#sidebar { 
  width: 360px; 
  flex-shrink: 0;
  background: rgba(28, 28, 30, 0.92); 
  backdrop-filter: blur(25px); 
  -webkit-backdrop-filter: blur(25px);
  color: #f2f2f7; 
  padding: 24px 20px; 
  padding-top: 68px; /* Space for top floating toggle button */
  display: flex; 
  flex-direction: column; 
  gap: 16px; 
  z-index: 2000; 
  overflow-y: auto; 
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  transition: margin-left 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Desktop Collapsed State */
#sidebar.collapsed {
  margin-left: -360px;
}


.search-box-container { position: relative; width: 100%; }
#search-input { 
  width: 100%; padding: 10px 14px; border-radius: 10px; border: none; 
  background: rgba(118, 118, 128, 0.24); color: #fff; font-size: 0.95rem; outline: none; 
}
#search-input::placeholder { color: rgba(235, 235, 245, 0.5); }

.search-results-dropdown {
  position: absolute; top: 46px; left: 0; right: 0;
  background: rgba(44, 44, 46, 0.98); backdrop-filter: blur(20px);
  border-radius: 12px; max-height: 240px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.15);
  display: none; z-index: 2000;
}
.search-result-item { padding: 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); cursor: pointer; }
.search-result-item:hover { background: rgba(255, 255, 255, 0.12); }
.search-result-title { font-weight: 600; font-size: 0.9rem; color: #fff; }
.search-result-sub { font-size: 0.75rem; color: #0a84ff; margin-top: 2px; }

.btn-group { display: flex; gap: 10px; }
button { 
  flex: 1; padding: 9px 14px; border: 1px solid rgba(255, 255, 255, 0.15); 
  background: rgba(255, 255, 255, 0.12); color: #f2f2f7; border-radius: 980px; 
  cursor: pointer; font-weight: 500; font-size: 0.85rem; 
}
button:hover { background: rgba(255, 255, 255, 0.22); }

#layer-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.layer-item { 
  display: flex; align-items: center; gap: 12px; font-size: 0.88rem; 
  background: rgba(255, 255, 255, 0.05); padding: 10px 12px; border-radius: 12px; 
  cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.04);
}
.layer-item input[type="checkbox"] { accent-color: #0a84ff; width: 16px; height: 16px; }
.color-badge { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.kingdom-info { display: flex; flex-direction: column; }
.kingdom-name { font-weight: 600; color: #fff; }
.kingdom-date { font-size: 0.75rem; color: rgba(235, 235, 245, 0.55); margin-top: 1px; }

#map { flex: 1; height: 100vh; z-index: 1; }

/* Google Maps Style Slide-Out Info Card */
#info-card {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 380px;
  max-height: calc(100vh - 40px);
  background: rgba(28, 28, 30, 0.94);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  z-index: 3000;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transform: translateX(420px);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}

#info-card.active {
  transform: translateX(0);
  opacity: 1;
}

.close-card-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}
.close-card-btn:hover { background: rgba(0, 0, 0, 0.85); }

.card-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#card-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.4px;
}

.card-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge-kingdom {
  background: #0a84ff;
  color: #fff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-era {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(235, 235, 245, 0.7);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
}

/* Detail rows: one per field the source actually filled in. */
.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.88rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: rgba(235, 235, 245, 0.5); flex-shrink: 0; }
.detail-value { color: rgba(235, 235, 245, 0.9); text-align: right; }

.detail-empty {
  font-size: 0.86rem;
  color: rgba(235, 235, 245, 0.45);
  font-style: italic;
}

.amenity-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(235, 235, 245, 0.5);
  margin-bottom: 8px;
}
.amenity-chip {
  display: inline-block;
  background: rgba(126, 217, 87, 0.15);
  color: #7ed957;
  border: 1px solid rgba(126, 217, 87, 0.3);
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.78rem;
  margin: 0 5px 5px 0;
}

/* Feature count beside each layer name in the sidebar. */
.layer-count {
  color: rgba(235, 235, 245, 0.4);
  font-weight: 400;
  font-size: 0.85em;
}

.source-note {
  margin-top: 16px;
  font-size: 0.72rem;
  line-height: 1.45;
  color: rgba(235, 235, 245, 0.4);
}

.directions-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  background: #30d158;
  color: #000;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 12px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}
.directions-btn:hover { opacity: 0.9; }

/* Mobile Drawer Adjustments */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 320px;
    max-width: 85vw;
    margin-left: 0;
    transform: translateX(0);
  }

  #sidebar.collapsed {
    margin-left: 0;
    transform: translateX(-100%);
  }

  #info-card {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 60vh;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
  }
  #info-card.active { transform: translateY(0); }
}
/* Header and utility classes. These replace style="" attributes that used to sit
   in index.html; the CSP served in production has no 'unsafe-inline' in
   style-src, so an inline style attribute would simply not apply. */
.site-header { margin-bottom: 4px; padding-right: 30px; }

.site-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 40px;
  color: #ffffff;
  font-weight: normal;
  margin: 0;
  line-height: 1.2;
}

.site-subtitle {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  font-size: 22px;
  color: #7ed957;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 4px;
}

.source-note a { color: rgba(126, 217, 87, 0.75); }

.search-no-result { color: #8e8e93; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
