:root {
  color-scheme: dark;
  font-family: "Trebuchet MS", "Aptos", "Segoe UI", sans-serif;
  color: #e7e3eb;
  background: #15121f;
  font-size: 13px;
  font-synthesis: none;
  --accent: #c6addd;
  --border: #423b49;
  --muted: #aaa2b0;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #2b2731;
  color: inherit;
  padding: 8px 11px;
  font-weight: 600;
}
button:hover:not(:disabled) {
  background: #39333f;
  border-color: #796c87;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
svg:focus-visible {
  outline: 2px solid #ead197;
  outline-offset: 3px;
}
button.primary {
  background: var(--accent);
  color: #211e26;
  border-color: var(--accent);
}
button.primary:hover:not(:disabled) {
  background: #ddc7ef;
}
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #2b2731;
  padding: 8px 11px;
  white-space: nowrap;
}
a.button:hover {
  background: #39333f;
}
input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}
.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
}
.inline-check input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}
.object-dot.route {
  background: #a5cfbc;
  border-color: #628e81;
  border-radius: 50%;
}
input,
select {
  display: block;
  width: 100%;
  height: 35px;
  margin-top: 6px;
  border: 1px solid #514857;
  border-radius: 5px;
  padding: 7px 9px;
  background: #2b2731;
  color: #e7e3eb;
}
input[type="color"] {
  padding: 3px;
  height: 31px;
  cursor: pointer;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  margin: 13px 0;
}
p {
  line-height: 1.6;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: 18px;
  letter-spacing: -0.5px;
  font-weight: 600;
}
h2 {
  font-size: 14px;
  font-weight: 600;
}
.muted {
  color: var(--muted);
  font-size: 11px;
  font-weight: normal;
  line-height: 1.6;
}
.badge {
  border-left: 1px solid #423b49;
  padding-left: 16px;
  color: var(--muted);
  font-size: 12px;
  margin-left: 6px;
}
.app-header {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #2b2731;
  border-bottom: 1px solid var(--border);
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.brand svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
}
.file-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.file-actions > span {
  font-size: 11px;
  color: var(--muted);
  margin-right: 10px;
}
.workspace {
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
  height: calc(100dvh - 66px);
  min-height: 530px;
}
.settings {
  overflow-y: auto;
  background: #211e26;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  padding-bottom: 22px;
}
.settings section {
  padding: 20px;
  border-bottom: 1px solid #3a3341;
}
.settings section h2 {
  margin-bottom: 8px;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.section-heading h2 {
  margin: 0 !important;
}
.text-button {
  padding: 0;
  background: none;
  border: none;
  font-weight: normal;
  font-size: 11px;
}
.danger {
  color: #eea49a;
}
.field-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}
.field-row label {
  flex: 1;
  min-width: 0;
}
.small-button {
  height: 35px;
  width: 35px;
  padding: 0;
  font-size: 23px;
  margin-bottom: 13px;
}
.wide {
  width: 100%;
  margin-top: 1px;
}
.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.two-columns label {
  min-width: 0;
}
.palette-options {
  display: flex;
  gap: 5px;
  margin-top: 12px;
}
.palette-options button {
  flex: 1;
  font-size: 11px;
  padding: 7px;
}
.palette-options button[aria-pressed="true"] {
  background: #42334e;
  border-color: #a98dbd;
}
.swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.swatches label {
  font-size: 10px;
  color: var(--muted);
  font-weight: normal;
  margin-bottom: 0;
}
.objects {
  display: grid;
  gap: 5px;
  margin-top: 12px;
}
.object-row {
  display: flex;
  align-items: center;
  text-align: left;
  width: 100%;
  font-weight: normal;
  font-size: 12px;
  padding: 9px 10px;
  gap: 8px;
  min-width: 0;
}
.object-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.object-row small {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
}
.object-row[aria-pressed="true"] {
  border-color: #a98dbd;
  background: #393044;
}
.object-dot {
  display: block;
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  background: #91b8a6;
  border: 1px solid #698e7e;
}
.object-dot.wall {
  background: #c8b083;
  border-color: #a18a5e;
}
.object-dot.district {
  border-radius: 50%;
  background: #9da9c7;
}
.starting-points > button {
  display: block;
  width: 100%;
  margin: 9px 0;
}
.settings details {
  font-size: 12px;
  color: var(--muted);
}
details p {
  margin-top: 10px;
}
details summary {
  cursor: pointer;
  margin-top: 10px;
}
.help {
  padding: 0 20px;
}
.map-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.map-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 16px 26px;
  background: #25212c;
  border-bottom: 1px solid #423b49;
}
.map-heading h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.6px;
  margin-bottom: 5px;
}
.map-heading span {
  font-size: 12px;
  color: var(--muted);
}
.history {
  display: flex;
  gap: 6px;
}
.history select {
  width: 82px;
  height: 30px;
  margin: 0;
  font-size: 11px;
  padding: 4px;
}
.elevation-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 4px;
}
.history .elevation-controls select {
  width: 104px;
}
.section-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: 11px;
  font-weight: normal;
  white-space: nowrap;
}
.section-toggle input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--accent);
}
.elevation-controls input[type="range"] {
  width: 120px;
  margin: 0;
}
.elevation-controls input[type="range"]:disabled {
  opacity: 0.35;
}
.history button {
  font-size: 11px;
  padding: 7px 10px;
}
.map-stage {
  position: relative;
  flex: 1;
  min-height: 300px;
  overflow: hidden;
  background: #192630;
}
.map-stage > svg {
  position: absolute;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline-offset: -3px;
}
.map-stage > canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
.building-tooltip {
  position: absolute;
  z-index: 2;
  max-width: 240px;
  padding: 9px 12px;
  background: #211e26;
  color: #e7e3eb;
  border: 1px solid #796c87;
  border-radius: 5px;
  box-shadow: 0 3px 15px #15121f80;
  font-size: 11px;
  line-height: 1.5;
  pointer-events: none;
}
.tools {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #514857;
  border-radius: 9px;
  padding: 5px;
  background: #211e26;
  box-shadow: 0 3px 15px #071e3029;
  max-width: calc(100% - 28px);
}
.tools button {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  border-color: transparent;
  background: transparent;
  padding: 8px 10px;
  font-size: 11px;
}
.tools svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tools button[aria-pressed="true"] {
  background: #42334e;
  color: #eadcf5;
}
.tool-divider {
  width: 1px;
  height: 20px;
  background: #514857;
  margin: 0 2px;
}
.map-controls {
  position: absolute;
  right: 20px;
  bottom: 20px;
  display: flex;
  gap: 4px;
}
.map-controls button {
  background: #2b2731;
  border-color: #796c87;
  font-size: 12px;
  min-width: 30px;
  height: 32px;
}
.map-key {
  position: absolute;
  bottom: 24px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--map-label, #e4edeb);
  font-size: 10px;
}
.key-reserved {
  width: 10px;
  height: 10px;
  border: 1px solid var(--map-reserved, #a5cfbc);
  background: #5a988755;
}
.key-wall {
  width: 13px;
  height: 3px;
  background: var(--map-wall, #cfb77e);
  margin-left: 10px;
}
.drawing-actions {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: #211e26;
  border: 1px solid #514857;
  box-shadow: 0 3px 15px #071e3029;
  border-radius: 7px;
  padding: 7px;
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}
.drawing-actions span {
  font-size: 11px;
  padding: 0 7px;
  color: var(--muted);
}
.drawing-actions button {
  font-size: 11px;
}
.layer-bar {
  display: flex;
  min-height: 55px;
  background: #211e26;
  border-bottom: 1px solid var(--border);
  align-items: stretch;
  padding-left: 14px;
  gap: 10px;
}
.layer-tabs {
  display: flex;
  overflow-x: auto;
  flex: 1;
  gap: 5px;
  align-items: stretch;
  min-width: 0;
}
.layer-tabs button {
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: none;
  white-space: nowrap;
  padding: 14px 17px;
  font-size: 12px;
  font-weight: normal;
}
.layer-tabs button[aria-selected="true"] {
  color: #eadcf5;
  border-bottom-color: #c6addd;
  background: #393044;
  font-weight: 600;
}
.layer-tabs .layer-number {
  border-radius: 3px;
  background: #423b49;
  padding: 2px 5px;
  font-size: 10px;
  margin-right: 6px;
}
.add-layer {
  border: none;
  background: none;
  border-left: 1px solid var(--border);
  border-radius: 0;
  padding: 0 20px;
  font-size: 12px;
}
.status-bar {
  min-height: 34px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 6px 22px;
  font-size: 11px;
  color: var(--muted);
  background: #25212c;
}
.status-bar [data-error="true"] {
  color: #eea49a;
}
.status-bar #statistics {
  white-space: nowrap;
}
.busy {
  position: absolute;
  right: 20px;
  top: 82px;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 12px;
  background: #393044;
  border-radius: 6px;
  color: #eadcf5;
  font-size: 11px;
  pointer-events: none;
}
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #796c87;
  border-top-color: #c6addd;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
#overlay .outline {
  fill: none;
  stroke: #bcd9d0;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 5 4;
}
#overlay .hover {
  fill: none;
  stroke: #ead197;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}
#overlay .section-line {
  fill: none;
  stroke: #ead197;
}
#overlay .section-label {
  fill: #ead197;
  font-family: Georgia, serif;
}
#overlay .selection {
  fill: #a5cfbc16;
  stroke: #d9f4e6;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
#overlay .vertex {
  fill: #f4faf7;
  stroke: #337a65;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  cursor: grab;
}
#overlay .draft {
  fill: #a5cfbc15;
  stroke: #d9f4e6;
  stroke-width: 2;
  stroke-dasharray: 5 4;
  vector-effect: non-scaling-stroke;
}
#overlay .label {
  font-family: "Trebuchet MS", sans-serif;
  fill: #dceee5;
  stroke: #192630;
  paint-order: stroke;
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}
[hidden] {
  display: none !important;
}
@media (min-width: 1550px) {
  .workspace {
    grid-template-columns: 310px minmax(0, 1fr);
  }
  .settings section {
    padding: 22px 26px;
  }
  .tools button {
    padding: 9px 14px;
  }
}
@media (max-width: 1000px) {
  .badge,
  .file-actions > span {
    display: none;
  }
  .tools button {
    padding: 8px;
  }
  .tools button span {
    display: none;
  }
  .tools svg {
    width: 20px;
    height: 20px;
  }
  .workspace {
    grid-template-columns: 245px minmax(0, 1fr);
  }
  .settings section {
    padding: 18px;
  }
  .map-heading {
    padding: 15px 20px;
  }
  .map-heading h2 {
    font-size: 19px;
  }
  .map-key {
    left: 16px;
  }
  .status-bar {
    padding: 6px 14px;
    font-size: 10px;
  }
}
@media (max-width: 640px) {
  .app-header {
    height: auto;
    min-height: 104px;
    padding: 14px 16px;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .file-actions {
    width: 100%;
  }
  .file-actions button {
    flex: 1;
    padding: 7px 8px;
    font-size: 11px;
  }
  .workspace {
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .map-workspace {
    order: -1;
    height: calc(78dvh - 70px);
    min-height: 480px;
  }
  .settings {
    overflow: visible;
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-right: 0;
  }
  .settings section {
    min-width: 0;
    padding: 18px 16px;
    border-right: 1px solid var(--border);
  }
  .map-heading {
    min-height: 64px;
    padding: 10px 16px;
  }
  .map-heading h2 {
    font-size: 18px;
  }
  .map-heading span {
    font-size: 11px;
  }
  .tools {
    top: 12px;
  }
  .tools button {
    padding: 6px;
  }
  .map-controls {
    right: 12px;
    bottom: 14px;
  }
  .map-key {
    bottom: 20px;
    font-size: 9px;
  }
  .layer-bar {
    min-height: 48px;
    padding-left: 4px;
    gap: 0;
  }
  .layer-tabs button {
    padding: 10px;
    font-size: 11px;
  }
  .add-layer {
    font-size: 11px;
    padding: 0 10px;
  }
  .status-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 7px 12px;
    min-height: 44px;
  }
  .help {
    padding-bottom: 20px;
  }
  .drawing-actions {
    bottom: 58px;
    gap: 5px;
    max-width: 96%;
  }
  .drawing-actions span {
    padding: 0;
  }
  .drawing-actions button {
    padding: 7px;
  }
  .busy {
    top: 70px;
    right: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}
.activity-key {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
  font-size: 10px;
  color: var(--muted);
}
.activity-key span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.activity-key i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}
.profession-fieldset {
  border: 0;
  padding: 0;
  margin: 18px 0;
}
.profession-fieldset legend {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}
#profession-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin-top: 12px;
}
#profession-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: normal;
  font-size: 11px;
}
#profession-options input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}
#district-character h3 {
  font-size: 12px;
  font-weight: 600;
  margin: 18px 0 10px;
}
.building-mix {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  font-size: 11px;
  color: var(--muted);
}
.building-mix > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.building-mix > div > span:last-child {
  white-space: nowrap;
}
#service-summary {
  margin-top: 14px;
}
.service-shortfall {
  font-size: 10px;
  line-height: 1.5;
  color: #ead197;
  margin-bottom: 8px;
}
#find-result {
  margin-top: 10px;
}

/* Sidebar panels: one group of settings at a time. */
.panel-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #2b2731;
  border-bottom: 1px solid var(--border);
}
.panel-tabs button {
  border: none;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: none;
  padding: 12px 4px 10px;
  font-size: 11px;
  color: var(--muted);
}
.panel-tabs button[aria-selected="true"] {
  color: #eadcf5;
  border-bottom-color: var(--accent);
}
.settings[data-tab="city"] section:not([data-panel="city"]),
.settings[data-tab="layer"] section:not([data-panel="layer"]),
.settings[data-tab="selection"] section:not([data-panel="selection"]),
.settings[data-tab="find"] section:not([data-panel="find"]) {
  display: none;
}
.settings section[hidden] {
  display: none;
}
.range-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.range-label output {
  font-weight: normal;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.row-button {
  height: 35px;
  margin-bottom: 13px;
}
.button-group {
  display: inline-flex;
}
.button-group button:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.button-group button:last-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: none;
}
.starting-points details {
  margin-top: 14px;
}
.view-only {
  display: none;
}

/* Viewing: the finished map, its layers and search, without editing tools. */
body[data-mode="view"] .edit-only,
body[data-mode="view"] .panel-tabs,
body[data-mode="view"] .tools,
body[data-mode="view"] .history button,
body[data-mode="view"] .add-layer,
body[data-mode="view"] .map-key,
body[data-mode="view"] #overlay .outline {
  display: none;
}
body[data-mode="view"] .view-only {
  display: block;
}
body[data-mode="view"] #canvas {
  cursor: grab;
}
#view-info-section .section-heading {
  margin-bottom: 12px;
}
