* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0b0e14;
  color: #e6edf3;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: #131824;
  border-bottom: 1px solid #232b3a;
  flex-shrink: 0;
  flex-wrap: wrap;
}

#topbar h1 {
  font-size: 16px;
  margin: 0;
  white-space: nowrap;
  color: #9fd0ff;
}

.control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.control label {
  color: #9aa7b8;
}

#search-input, #faction-select, #layer-select {
  background: #0f1420;
  color: #e6edf3;
  border: 1px solid #2a3345;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 13px;
}

#search-input {
  width: 200px;
}

.search-wrap {
  position: relative;
}

.status-text {
  margin-left: auto;
  font-size: 12px;
  color: #9aa7b8;
  white-space: nowrap;
}

#main {
  flex: 1;
  display: flex;
  min-height: 0;
}

#map-viewport {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #1e2836;
  cursor: grab;
  user-select: none;
}

#map-viewport.dragging {
  cursor: grabbing;
}

#tile-layer, #marker-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#tile-layer img {
  position: absolute;
  width: 256px;
  height: 256px;
  image-rendering: pixelated;
  pointer-events: none;
}

#tile-layer img.tile-error {
  outline: 1px dashed #5a2a2a;
}

.poi-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #0b0e14;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 0 4px rgba(0,0,0,0.6);
}

.poi-marker:hover {
  transform: translate(-50%, -50%) scale(1.3);
}

.poi-marker.selected {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.poi-marker.faction-autobot { background: #d64545; }
.poi-marker.faction-decepticon { background: #7a3fd6; }
.poi-marker.faction-neutral { background: #4a9d5f; }
.poi-marker.faction-unknown { background: #8a8f98; }

.poi-label {
  position: absolute;
  transform: translate(8px, -8px);
  font-size: 11px;
  color: #e6edf3;
  background: rgba(11,14,20,0.7);
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
}

.overlay-panel {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(19,24,36,0.92);
  border: 1px solid #2a3345;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  z-index: 10;
}

.overlay-panel.error {
  border-color: #7a3131;
  color: #ffb4b4;
}

.overlay-panel.hidden {
  display: none;
}

#zoom-controls {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}

#zoom-controls button {
  width: 32px;
  height: 32px;
  background: #131824;
  color: #e6edf3;
  border: 1px solid #2a3345;
  border-radius: 4px;
  font-size: 18px;
  cursor: pointer;
}

#zoom-controls button:hover {
  background: #1c2333;
}

#sidebar {
  width: 320px;
  flex-shrink: 0;
  background: #131824;
  border-left: 1px solid #232b3a;
  padding: 16px;
  overflow-y: auto;
  position: relative;
}

#sidebar.hidden {
  display: none;
}

#sidebar-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #9aa7b8;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

#sidebar-close:hover {
  color: #e6edf3;
}

#sidebar-content h2 {
  margin: 0 24px 4px 0;
  font-size: 18px;
  color: #9fd0ff;
}

#sidebar-content .meta-line {
  font-size: 12px;
  color: #9aa7b8;
  margin-bottom: 10px;
}

#sidebar-content .badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 4px;
  background: #232b3a;
}

#sidebar-content p.description {
  font-size: 13px;
  line-height: 1.5;
  color: #d6dee8;
}

#sidebar-content .tags {
  margin-top: 12px;
}

#sidebar-content .tag {
  display: inline-block;
  font-size: 11px;
  background: #1c2333;
  border: 1px solid #2a3345;
  border-radius: 10px;
  padding: 2px 8px;
  margin: 0 4px 4px 0;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #0f1420;
  border: 1px solid #2a3345;
  border-radius: 4px;
  margin-top: 2px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 20;
}

.search-results .search-result-item {
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}

.search-results .search-result-item:hover {
  background: #1c2333;
}

.search-results.hidden {
  display: none;
}
