.lm-tools,
.lm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
  align-items: center;
}
.lm-tools input {
  min-width: 180px;
  flex: 1;
}
.lm-tools select {
  width: auto;
  max-width: 280px;
}
.lm-tools button,
.lm-neighbor button {
  min-height: 44px;
}
.lm-layout {
  --lm-details-width: clamp(240px, 20vw, 300px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--lm-details-width);
  position: relative;
  gap: 18px;
  background: #f8f7f3;
}
.lm-viewport {
  height: 580px;
  overflow: hidden;
  position: relative;
  background: #e8f5fc;
  border: 1px solid #16305226;
  border-radius: 20px;
  touch-action: none;
}
.lm-stage {
  position: absolute;
  transform-origin: 0 0;
}
.lm-edges {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
}
.lm-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 180px;
  min-height: 84px;
  padding: 10px 12px;
  border: 2px solid #16305233;
  border-radius: 14px;
  background: white;
  color: #163052;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 2px 5px #16305215;
  text-align: left;
  cursor: pointer;
}
.lm-node strong {
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.lm-node span,
.lm-node small {
  font-size: 11px;
}
.lm-node[aria-pressed="true"] {
  outline: 3px dashed #163052;
  outline-offset: 3px;
}
.lm-node.doing_well {
  border-color: #078c88;
}
.lm-node.developing {
  border-color: #526884;
}
.lm-node.needs_practice {
  border-color: #ff785c;
}
.lm-state {
  font-size: 13px;
  color: #163052;
}
.lm-details {
  padding: 20px;
  background: white;
  border: 1px solid #16305226;
  border-radius: 20px;
  overflow: auto;
  max-height: 580px;
}
.lm-details p {
  margin: 8px 0;
}
.lm-details section {
  margin-top: 22px;
}
.lm-neighbor {
  margin: 10px 0;
}
.lm-search-results {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lm-search-results:empty {
  display: none;
}
.lm-layout:fullscreen {
  padding: 24px;
  height: 100vh;
}
.lm-layout:fullscreen .lm-viewport,
.lm-layout:fullscreen .lm-details {
  height: 100%;
  max-height: none;
}
@media (max-width: 1000px) {
  .lm-layout {
    grid-template-columns: 1fr;
  }
  .lm-viewport {
    height: 480px;
  }
  .lm-details {
    max-height: none;
  }
}

.lm-fullscreen-controls {
  display: none;
}
.lm-layout:fullscreen {
  grid-template-rows: auto minmax(0, 1fr);
}
.lm-layout:fullscreen .lm-fullscreen-controls {
  display: flex;
  gap: 12px;
  grid-column: 1/-1;
  grid-row: 1;
}
.lm-layout:fullscreen .lm-viewport,
.lm-layout:fullscreen .lm-details {
  grid-row: 2;
}

.lm-node {
  height: 100px;
  box-sizing: border-box;
}
.lm-node strong {
  font-size: 14px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* Keep everyday filters visible; tuck exploration options and evidence away. */
.lm-tools { flex-wrap: nowrap; gap: 12px; margin: 12px 0 8px; }
.lm-tools > input,
.lm-tools > select,
.lm-tools .progress-map-subjects select {
  min-height: 44px;
  border: 1px solid #16305226;
  border-radius: 12px;
  background: white;
  color: #163052;
  padding: 10px 36px 10px 14px;
  font: inherit;
  box-sizing: border-box;
}
.lm-tools > input { min-width: 150px; max-width: 320px; margin-left: auto; padding-right: 14px; }
.lm-tools > input[type="search"] {
  appearance: none; -webkit-appearance: none;
  border-radius: 12px;
}
.lm-tools > select { width: 170px; }
.lm-tools > select,
.lm-tools .progress-map-subjects select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23163052' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 42px;
}
.lm-tools .progress-map-subjects { margin: 0; flex: 0 1 200px; min-width: 150px; }
.lm-tools .progress-map-subjects select { width: 100%; }
.lm-evidence summary { cursor: pointer; color: #078c88; font-weight: 600; }
.lm-tools [hidden] { display: none !important; }
.lm-layout:not(.lm-has-selection) .lm-details { display: block; }
.lm-camera-controls {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  display: flex; gap: 4px; background: white;
  padding: 3px; border: 1px solid #16305226; border-radius: 12px;
  box-shadow: 0 2px 8px #16305212;
}
.lm-camera-controls button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  padding: 0; line-height: 1; font-size: 22px;
}
.lm-layout:fullscreen .lm-camera-controls { display: none; }
.lm-legend {
  user-select: none; -webkit-user-select: none;
  pointer-events: none;
  position: absolute; bottom: 16px; left: 16px; right: 16px; z-index: 2;
  justify-content: center; margin: 0; gap: 10px 18px;
  padding: 10px 14px; border: 1px solid #16305226; border-radius: 12px;
  background: white; box-shadow: 0 2px 8px #16305212;
}
.lm-legend > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; line-height: 20px; }
.lm-legend-symbol { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 20px; flex-shrink: 0; }
.lm-viewport { grid-column: 1; grid-row: 1; }
.lm-details {
  position: static; grid-column: 2; grid-row: 1; width: var(--lm-details-width); height: 580px;
  box-sizing: border-box;
}
.lm-close-details { display: block; margin: 0 0 12px auto; }
.lm-layout:fullscreen .lm-details { grid-row: 2; height: 100%; }
.lm-tools { width: calc(100% - clamp(240px, 20vw, 300px) - 18px); }
.lm-tools .progress-map-subjects { flex: 0 1 150px; min-width: 120px; }
.lm-tools > select { flex: 0 1 140px; min-width: 120px; }
.lm-tools > input { min-width: 120px; }
.lm-topic-state { color: #526884; font-size: 13px; }
.lm-evidence { margin: 16px 0; padding: 12px 0; border-block: 1px solid #16305215; }
@media (max-width: 1100px) {
  .lm-tools { flex-wrap: wrap; }
  .lm-tools > input { flex-basis: 220px; }
}
@media (max-width: 1000px) {
  .lm-tools { width: 100%; }
  .lm-details { position: static; width: auto; height: auto; grid-column: 1; grid-row: 2; box-shadow: none; }
  .lm-has-selection .lm-camera-controls { right: 14px; }
  .lm-has-selection .lm-legend { right: 16px; }
  .lm-layout:fullscreen .lm-details { position: static; grid-row: 3; }
}

.lm-loading {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  background: #e8f5fce8; color: #526884; font-size: 14px;
  pointer-events: none;
}
.lm-loading[hidden] { display: none; }
.lm-status { min-height: 21px; margin: 8px 0; }

/* Keep feedback and recovery where the map is, without moving the filters. */
.lm-viewport, .lm-details { height: var(--lm-canvas-height, 420px); }
.lm-details { max-height: 580px; }
.lm-error { position: absolute; inset: 70px 20px 110px; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.lm-error[hidden] { display: none; }
.lm-loading { pointer-events: auto; }
.lm-loading, .lm-error { color: #163052; }
.lm-meaning { flex-basis: 100%; justify-content: center; font-size: 12px; white-space: normal !important; text-align: center; }
.lm-unclassified { display: block; margin-top: 4px; }
.lm-status button { margin-left: 8px; }
.lm-search-result { flex: 1 1 220px; display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px; border: 1px solid #16305226; background: white; border-radius: 12px; }
.lm-search-result .hint { font-weight: 400; font-size: 12px; }
@media(max-width:1000px) { .lm-layout:not(.lm-has-selection) .lm-details { display: none; } .lm-details { height: auto; } }

.lm-layout:fullscreen .lm-viewport, .lm-layout:fullscreen .lm-details { height: 100%; }

.lm-search-result .hint { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 1.5; }
