* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: sans-serif;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

header {
  padding: 10px 16px;
  background: #2c5282;
  color: #fff;
  flex-shrink: 0;
}

header h1 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

#header-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

#count-info {
  font-size: 0.78rem;
  color: #bee3f8;
}

#mode-controls {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.mode-btn {
  padding: 3px 10px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.mode-btn:hover {
  background: rgba(255,255,255,0.22);
}

.mode-btn-active {
  background: rgba(255,255,255,0.32);
  border-color: #fff;
  font-weight: bold;
}

#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#map {
  flex: 1;
  min-height: 400px;
}

#detail-panel {
  width: 280px;
  flex-shrink: 0;
  padding: 16px;
  background: #f7fafc;
  border-left: 1px solid #e2e8f0;
  overflow-y: auto;
}

#detail-panel .placeholder {
  color: #718096;
  font-size: 0.9rem;
  margin: 0;
}

#detail-panel .detail-title {
  font-size: 0.85rem;
  font-weight: bold;
  color: #2c5282;
  margin: 0 0 12px;
}

#detail-panel dl {
  margin: 0;
}

#detail-panel dt {
  font-size: 0.75rem;
  color: #718096;
  margin-top: 10px;
}

#detail-panel dd {
  margin: 2px 0 0;
  font-size: 0.9rem;
  color: #1a202c;
  word-break: break-all;
}

@media (max-width: 640px) {
  #map {
    flex: 1;
    min-height: unset;
  }

  #detail-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 55dvh;
    border-left: none;
    border-top: 2px solid #e2e8f0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.25s ease;
    z-index: 100;
  }

  #detail-panel.panel-active {
    transform: translateY(0);
  }

  .panel-close-btn {
    float: right;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #718096;
    cursor: pointer;
    padding: 0;
    line-height: 1;
  }
}
