.trace-location-shell {
  display: grid;
  width: min(100%, 96rem);
  margin-inline: auto;
  gap: 1.25rem;
}

.trace-location-heading {
  align-items: flex-start;
  gap: 1rem;
}

.trace-location-heading-actions,
.trace-location-editor-actions,
.trace-location-filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
}

.trace-location-state-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 10rem;
  padding: 1.4rem;
}

.trace-location-state-symbol {
  display: grid;
  width: 3.2rem;
  height: 3.2rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(8, 127, 111, 0.28);
  border-radius: 1rem;
  background: rgba(8, 127, 111, 0.08);
  color: var(--accent-strong);
  font-weight: 800;
}

.trace-location-state-action {
  margin-top: 0.8rem;
}

.trace-location-badge-restricted,
.trace-location-badge-error {
  border-color: color-mix(in srgb, var(--danger) 36%, transparent);
  color: var(--danger);
}

.trace-location-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.trace-location-access-value {
  font-size: clamp(1.25rem, 2.2vw, 2rem);
}

.trace-location-main-grid {
  display: grid;
  grid-template-columns: minmax(20rem, 0.82fr) minmax(28rem, 1.18fr);
  align-items: start;
  gap: 1.25rem;
}

.trace-location-registry-card,
.trace-location-editor-card {
  min-width: 0;
  padding: 1.25rem;
}

.trace-location-editor-card {
  position: sticky;
  top: 5.8rem;
}

.trace-location-section-heading,
.trace-location-editor-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.trace-location-section-heading h2,
.trace-location-editor-heading h2,
.trace-location-list-empty h3 {
  margin: 0.18rem 0 0.35rem;
}

.trace-location-filter-form {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(8rem, 0.7fr) minmax(6rem, 0.45fr) minmax(
      6rem,
      0.45fr
    );
  gap: 0.8rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: color-mix(in srgb, var(--background-soft) 58%, transparent);
}

.trace-location-filter-form label,
.trace-location-field {
  display: grid;
  align-content: start;
  gap: 0.38rem;
  min-width: 0;
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 720;
  letter-spacing: 0.02em;
}

.trace-location-filter-form input,
.trace-location-filter-form select,
.trace-location-editor-form input,
.trace-location-editor-form select {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.68rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.7rem;
  background: var(--background-raised);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
}

.trace-location-filter-form input:disabled,
.trace-location-filter-form select:disabled,
.trace-location-editor-form input:disabled,
.trace-location-editor-form select:disabled {
  border-color: var(--border);
  background: var(--background-soft);
  color: var(--muted);
}

.trace-location-filter-actions,
.trace-location-filter-status {
  grid-column: 1 / -1;
}

.trace-location-filter-status {
  min-height: 1.25rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.trace-location-list {
  display: grid;
  max-height: 48rem;
  gap: 0.65rem;
  margin-top: 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.trace-location-list-item {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 0.45rem;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: var(--background-raised);
  color: var(--text);
  text-align: left;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.trace-location-list-item:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  transform: translateY(-1px);
}

.trace-location-list-item-selected {
  border-color: color-mix(in srgb, var(--accent) 66%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 11%, transparent);
}

.trace-location-list-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.65rem;
}

.trace-location-list-heading strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.trace-location-list-item code {
  display: block;
  width: 100%;
  overflow: hidden;
  color: var(--accent-strong);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trace-location-list-metadata,
.trace-location-list-coordinate {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.trace-location-list-empty {
  padding: 1.4rem;
  border: 1px dashed var(--border-strong);
  border-radius: 0.9rem;
  text-align: center;
}

.trace-location-editor-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.trace-location-field-wide {
  grid-column: 1 / -1;
}

.trace-location-field small,
.trace-location-coordinate-actions span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.45;
}

.trace-location-coordinate-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.25rem 0;
}

.trace-location-preview {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 1rem;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.52), transparent 58%),
    linear-gradient(180deg, rgba(184, 218, 231, 0.74), rgba(214, 230, 236, 0.94));
}

.trace-location-preview-map {
  display: block;
  width: 100%;
  height: 20rem;
}

.trace-location-preview-sphere {
  fill: rgba(183, 217, 229, 0.56);
  stroke: rgba(8, 127, 111, 0.3);
  stroke-width: 1.2;
}

.trace-location-preview-grid path {
  fill: none;
  stroke: rgba(50, 105, 126, 0.16);
  stroke-width: 0.8;
}

.trace-location-preview-land {
  fill: rgba(17, 31, 43, 0.88);
  filter: drop-shadow(0 6px 10px rgba(16, 32, 51, 0.18));
}

.trace-location-preview-borders,
.trace-location-preview-coast {
  fill: none;
  stroke: rgba(96, 181, 184, 0.48);
  stroke-width: 0.85;
}

.trace-location-preview-coast {
  stroke: rgba(175, 230, 226, 0.7);
  stroke-width: 1.15;
}

.trace-location-preview-marker circle:first-child {
  fill: rgba(8, 127, 111, 0.18);
  stroke: rgba(8, 127, 111, 0.5);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: trace-location-preview-pulse 1.9s ease-out infinite;
}

.trace-location-preview-marker circle:last-child {
  fill: #087f6f;
  stroke: #ffffff;
  stroke-width: 4;
  filter: drop-shadow(0 3px 7px rgba(8, 127, 111, 0.45));
}

@keyframes trace-location-preview-pulse {
  from {
    transform: scale(0.65);
    opacity: 0.9;
  }

  to {
    transform: scale(1.35);
    opacity: 0;
  }
}

.trace-location-preview-caption {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-top: 1px solid rgba(8, 127, 111, 0.2);
  background: color-mix(in srgb, var(--background-raised) 88%, transparent);
  color: var(--muted-strong);
  font-size: 0.78rem;
  line-height: 1.45;
}

.trace-location-editor-metadata {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 1rem 0 0;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  overflow: hidden;
}

.trace-location-editor-metadata:empty {
  display: none;
}

.trace-location-editor-metadata div {
  min-width: 0;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.trace-location-editor-metadata div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.trace-location-editor-metadata dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.trace-location-editor-metadata dd {
  margin: 0.3rem 0 0;
  overflow-wrap: anywhere;
  color: var(--muted-strong);
  font-size: 0.78rem;
}

.trace-location-boundary {
  margin: 0;
  padding-left: 0.8rem;
  border-left: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

@media (max-width: 74rem) {
  .trace-location-main-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .trace-location-editor-card {
    position: static;
  }

  .trace-location-list {
    max-height: 30rem;
  }
}

@media (max-width: 58rem) {
  .trace-location-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trace-location-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trace-location-filter-wide {
    grid-column: 1 / -1;
  }

  .trace-location-preview-map {
    height: 17rem;
  }
}

@media (max-width: 42rem) {
  .trace-location-heading,
  .trace-location-section-heading,
  .trace-location-editor-heading {
    display: grid;
  }

  .trace-location-heading-actions,
  .trace-location-heading-actions > *,
  .trace-location-editor-actions,
  .trace-location-editor-actions > *,
  .trace-location-filter-actions,
  .trace-location-filter-actions > * {
    width: 100%;
  }

  .trace-location-metrics,
  .trace-location-filter-form,
  .trace-location-editor-form,
  .trace-location-editor-metadata {
    grid-template-columns: minmax(0, 1fr);
  }

  .trace-location-field-wide,
  .trace-location-filter-wide,
  .trace-location-filter-actions,
  .trace-location-filter-status {
    grid-column: 1;
  }

  .trace-location-editor-metadata div,
  .trace-location-editor-metadata div:nth-last-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

  .trace-location-editor-metadata div:last-child {
    border-bottom: 0;
  }

  .trace-location-preview-map {
    height: 14rem;
  }

  .trace-location-registry-card,
  .trace-location-editor-card {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .trace-location-preview-marker circle:first-child {
    animation: none;
  }

  .trace-location-list-item {
    transition: none;
  }
}
