:root {
  --bg: #0f1115;
  --panel: #171a21;
  --border: #2a2f3a;
  --text: #e6e8eb;
  --muted: #8a93a3;
  --accent: #4c9aff;
}

* { box-sizing: border-box; }

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

body {
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

header h1 { margin: 0 0 0.25rem; font-size: 1.25rem; }
header p { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.9rem; }

#search {
  position: relative;
  max-width: 360px;
  display: flex;
  gap: 0.5rem;
}

#search input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
}

#locate-btn {
  flex-shrink: 0;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

#locate-btn:hover { border-color: var(--accent); }
#locate-btn:disabled { opacity: 0.6; cursor: default; }

#search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 260px;
  overflow-y: auto;
}

#search-results:empty { border: none; }

#search-results .results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

#search-results li {
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

#search-results li:last-child { border-bottom: none; }
#search-results li:hover { background: var(--bg); }
#search-results li.hint { cursor: default; }

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

#map {
  flex: 1;
  background: #1c1f26;
}

#panel {
  width: 340px;
  padding: 1rem;
  border-left: 1px solid var(--border);
  background: var(--panel);
  overflow-y: auto;
}

#panel-handle { display: none; }

#panel h2 { font-size: 1rem; margin-top: 0; }

#panel-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2100;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  transition: right 0.25s ease;
}

main:not(.panel-collapsed) #panel-toggle {
  right: 356px;
}

main.panel-collapsed #panel {
  width: 0;
  padding: 0;
  border-left: none;
  overflow: hidden;
}

@media (max-width: 640px) {
  #panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 110px;
    padding: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #panel-handle {
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    padding: 10px 0 6px;
    cursor: grab;
    touch-action: none;
  }

  #panel-handle::before {
    content: "";
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
  }

  #panel-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 1rem 1rem;
  }

  main:not(.panel-collapsed) #panel-toggle {
    right: 12px;
  }

  main.panel-collapsed #panel {
    width: 100%;
    border-top: none;
    box-shadow: none;
  }
}

textarea {
  width: 100%;
  min-height: 70px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem;
  resize: vertical;
}

button {
  margin-top: 0.5rem;
  background: var(--accent);
  color: #0f1115;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

ul#comment-list { list-style: none; padding: 0; margin-top: 1rem; }

ul#comment-list li {
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0;
}

ul#comment-list li p { margin: 0 0 0.25rem; }
ul#comment-list li small { color: var(--muted); font-size: 0.75rem; }

.hint { color: var(--muted); font-size: 0.9rem; }
