body {
  font-family: system-ui, sans-serif;
  max-width: 700px;
  margin: 1rem auto;
  padding: 0 1rem;
}

#browser-warning {
  background: #fff3cd;
  border: 1px solid #d6a02c;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
}

/* § Local test data cache — loud on purpose (red, not the browser-warning's
   amber) so an accidental deploy/push with the cache flag left on is
   unmissable in any screenshot taken before pushing. */
#dev-cache-banner {
  background: #f8d7da;
  border: 2px solid #c0392b;
  color: #7a1f1f;
  font-weight: bold;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
}

#search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#search-form label {
  flex-basis: 100%;
}

#location-input {
  flex: 1;
  min-width: 200px;
  padding: 0.4rem;
}

#anchor-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

#map-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

#map-container {
  border: 1px solid #999;
  flex: 1;
  min-width: 0;
}

/* § POIs — the list box of additional POIs, to the left of the map. Fixed
   width on the select itself (not just the container) since a <select>
   otherwise sizes to its longest option's full text, which can badly
   overflow the page for a long address. */
#poi-list-container {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 9rem;
}

#poi-list {
  width: 9rem;
  overflow-x: hidden;
  text-overflow: ellipsis;
}

#btn-drop-pin {
  margin-top: 0.4rem;
}

#map {
  display: block;
  width: 100%;
  height: auto;
  background: #fafafa;
}

#map .street {
  fill: none;
  stroke: #555;
  stroke-width: 1;
}

#map .anchor-poi {
  fill: #1a1a1a;
}

#map .additional-poi {
  fill: #1a1a1a;
}

#map .cursor {
  fill: none;
  stroke: #c0392b;
  stroke-width: 1.5;
}

/* § Pan Behavior — mouse-only pan affordance (see createPanEdgeBar in
   app.js); subtle by default, brightens on hover for obvious click
   feedback. Intentionally invisible to assistive tech -- see the comment
   above createPanEdgeBar for why. */
#map .pan-edge-bar {
  fill: #1a1a1a;
  opacity: 0.12;
  cursor: pointer;
}

#map .pan-edge-bar:hover {
  opacity: 0.35;
}

/* § Braille labels — zones render as empty bordered regions until label
   content exists. */
#map .label-zone {
  fill: #eee;
  stroke: #bbb;
  stroke-dasharray: 4 2;
}

/* § Braille labels — the on-screen SVG shows each label as plain print
   text (the tactile raster sent to the device still gets real braille
   dots -- see drawLabelDotsToPixels/drawLabelContent in app.js), so
   sighted and blind users looking at the same map can read/discuss the
   same labels. Same fill as the POI markers for a consistent solid look
   against the label-zone's lighter background; monospace keeps character
   width predictable against the layout math in drawLabelContent. */
#map .label-text {
  fill: #1a1a1a;
  font-family: ui-monospace, "Courier New", monospace;
  text-anchor: middle;
}

#app-menu-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#main-menu-container {
  position: relative;
}

#main-menu-button {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#main-menu-button::after {
  content: "\25BE";
  font-size: 0.8em;
}

#main-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1;
  margin: 0.25rem 0 0;
  padding: 0.25rem;
  list-style: none;
  background: Canvas;
  color: CanvasText;
  border: 1px solid #999;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  min-width: 12rem;
}

#main-menu li {
  margin: 0;
}

#main-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.6rem;
  border: none;
  background: none;
  font-size: 1rem;
  cursor: pointer;
}

#main-menu button:hover,
#main-menu button:focus {
  background: Highlight;
  color: HighlightText;
  outline: none;
}

#main-menu button[aria-disabled="true"] {
  color: GrayText;
  cursor: not-allowed;
}

#settings-dialog,
#poi-too-far-dialog,
#edit-map-dialog,
#custom-poi-dialog,
#save-map-dialog,
#delete-saved-map-dialog,
#did-you-mean-dialog {
  border: 1px solid #999;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  max-width: 24rem;
}

/* § My Archives — two tables plus a Save Map dialog worth of content, so
   it gets the same wider, scrollable treatment as Help rather than the
   24rem dialogs above. */
#my-archives-dialog {
  border: 1px solid #999;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  max-width: 42rem;
  max-height: 80vh;
  overflow-y: auto;
}

#my-archives-dialog table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5rem 0 1rem;
}

#my-archives-dialog th,
#my-archives-dialog td {
  border: 1px solid #ccc;
  padding: 0.3rem 0.5rem;
  text-align: left;
}

#my-archives-dialog table button {
  font: inherit;
}

/* § My Archives — Saved Maps' Name/Date column headers double as sort
   controls (click to sort by that column) rather than separate radio
   buttons. aria-sort on the <th> (set in app.js) communicates the active
   column/direction to screen readers; the arrow here is a sighted-only
   echo of that same state. */
.sort-header {
  border: none;
  background: none;
  font: inherit;
  font-weight: bold;
  padding: 0;
  cursor: pointer;
}

.sort-header:hover,
.sort-header:focus {
  text-decoration: underline;
  outline: none;
}

/* § "Did you mean...?" dialog — each candidate is a button styled to read
   as a link (looks/behaves like a link, but is a real <button> performing
   an in-page action rather than navigating -- same reasoning as
   .sort-header above, just without the bold weight that's specific to
   column-header sort controls). */
#did-you-mean-list {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
}

#did-you-mean-list li {
  margin: 0.3rem 0;
}

.candidate-link {
  border: none;
  background: none;
  font: inherit;
  color: #1155cc;
  text-decoration: underline;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.candidate-link:hover,
.candidate-link:focus {
  color: #0d3d99;
  outline: none;
}

th[aria-sort="ascending"] .sort-header::after {
  content: " \25B2";
}

th[aria-sort="descending"] .sort-header::after {
  content: " \25BC";
}

/* § My Archives — a single shared Actions popup menu, repositioned per row
   (see openRowActionsMenu in app.js) rather than one menu widget per row.
   Same look as #main-menu, but position: fixed since it's placed via
   getBoundingClientRect viewport coordinates, not relative to a
   same-sized parent. */
#row-actions-menu {
  position: fixed;
  z-index: 2;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  background: Canvas;
  color: CanvasText;
  border: 1px solid #999;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  min-width: 10rem;
}

#row-actions-menu li {
  margin: 0;
}

#row-actions-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.6rem;
  border: none;
  background: none;
  font-size: 1rem;
  cursor: pointer;
}

#row-actions-menu button:hover,
#row-actions-menu button:focus {
  background: Highlight;
  color: HighlightText;
  outline: none;
}

#save-map-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

#save-map-name,
#save-map-notes {
  width: 100%;
}

/* § Help — much richer content (several tables) than the other dialogs, so
   it gets its own wider, scrollable box rather than sharing the 24rem
   max-width above. */
#help-dialog {
  border: 1px solid #999;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  max-width: 42rem;
  max-height: 80vh;
  overflow-y: auto;
}

#help-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5rem 0 1rem;
}

#help-content th,
#help-content td {
  border: 1px solid #ccc;
  padding: 0.3rem 0.5rem;
  text-align: left;
}

#help-content ol {
  padding-left: 1.5rem;
}

#custom-poi-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

#custom-poi-name {
  width: 100%;
}

#settings-dialog div {
  margin: 0.4rem 0;
}

/* § Editing the Map — each group's checkbox list scrolls on its own rather
   than letting the whole dialog grow unbounded when a map has many streets. */
#edit-map-dialog details {
  border: 1px solid #ccc;
  border-radius: 4px;
  margin: 0.6rem 0;
  padding: 0.5rem 0.75rem;
}

#edit-map-dialog .edit-map-list {
  max-height: 8rem;
  overflow-y: auto;
}

/* § Editing the Map — h4 inside summary keeps each group heading-navigable
   for screen readers while staying a native disclosure widget; the inline
   override stops it from taking on default h4 block spacing/sizing next
   to the triangle marker. */
#edit-map-dialog summary h4 {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

#edit-map-dialog .edit-map-list button {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0.2rem 0;
}

#message-display {
  margin-top: 0.5rem;
  min-height: 1.4em;
  font-size: 0.95rem;
}

footer {
  margin-top: 2rem;
  color: #777;
  font-size: 0.8rem;
}
