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

#map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
}

.camera-info-panel {
  display: none;
  position: fixed;
  right: 10px;
  bottom: 50px;
  margin: 0;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font: 12px/1.5 monospace;
  border-radius: 4px;
  user-select: text;
  z-index: 10;
}

.camera-info-panel.visible {
  display: block;
}

/* ── Article sidebar ──────────────────────────────────────────────────────
   A left overlay panel that browses thunderbay.wiki and renders articles in
   place. It floats above the map (which stays interactive on the right) and
   slides off-screen when closed so the full map is usable. On phones it
   covers the viewport since there is no room to show map and panel at once. */

#sidebar-toggle {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 20;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font: 14px/1 system-ui, sans-serif;
  cursor: pointer;
}

#sidebar-toggle:hover {
  background: rgba(0, 0, 0, 0.9);
}

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 360px;
  max-width: 90vw;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);
  /* translateX keeps the panel laid out (so its scroll position and any
     in-flight fetch survive) while moving it out of view when closed. */
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  font: 15px/1.5 system-ui, sans-serif;
  color: #202122;
}

#sidebar.open {
  transform: translateX(0);
}

#sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #c8ccd1;
  background: #f8f9fa;
}

#sidebar-title {
  flex: 1;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sidebar-header button {
  border: none;
  background: transparent;
  font-size: 15px;
  cursor: pointer;
  color: #54595d;
  padding: 4px 6px;
  border-radius: 4px;
}

#sidebar-header button:hover {
  background: #eaecf0;
}

#article-browse {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Reading view replaces browse view: hide the list, show the article. */
#sidebar.reading #article-browse {
  display: none;
}

#article-filter {
  margin: 10px 12px;
  padding: 7px 10px;
  border: 1px solid #c8ccd1;
  border-radius: 4px;
  font: inherit;
}

#article-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

#article-list li {
  margin: 0;
}

#article-list button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 14px;
  border: none;
  background: transparent;
  font: inherit;
  color: #3366cc;
  cursor: pointer;
}

#article-list button:hover {
  background: #eaf3ff;
}

.sidebar-status {
  padding: 10px 14px;
  color: #72777d;
  font-style: italic;
}

#article-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
}

/* Constrain wiki-supplied media so wide infoboxes/thumbs never force the
   panel to scroll horizontally. */
#article-content img {
  max-width: 100%;
  height: auto;
}

#article-content table,
#article-content .infobox {
  max-width: 100%;
  display: block;
  overflow-x: auto;
}

#article-content h1,
#article-content h2,
#article-content h3 {
  line-height: 1.25;
}

#article-content a {
  color: #3366cc;
}

.location-infobox {
  border: 1px solid #c8ccd1;
  background: #f8f9fa;
  border-radius: 4px;
  padding: 8px 10px;
  margin: 0 0 12px;
  float: right;
  max-width: 45%;
  font-size: 0.9em;
}

@media (max-width: 600px) {
  #sidebar {
    width: 100vw;
    max-width: 100vw;
  }
}
