.paper-fragment {
  position: absolute;
  z-index: 4;
  border: 1px solid rgba(37,44,41,.38);
  background: rgba(247,242,231,.96);
  box-shadow: 0 10px 24px rgba(65,52,33,.12);
}

.paper-fragment img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.paper-fragment__caption {
  padding: 8px 10px 9px;
  border-top: 1px solid var(--rule);
  font-size: 11px;
  line-height: 1.45;
}

.map-label,
.meaning-item {
  position: absolute;
  z-index: 6;
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.map-label::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -18px;
  width: 12px;
  border-top: 1px solid currentColor;
}

.map-label__type {
  display: block;
  margin-bottom: 3px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--clay);
}

.map-label__name {
  display: block;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.05;
}

.map-label__detail {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 10px;
}

.map-label.is-selected .map-label__name,
.meaning-item.is-selected .meaning-item__name {
  text-decoration: underline;
  text-decoration-color: var(--clay);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.contour-field {
  position: absolute;
  z-index: 1;
  opacity: .58;
  pointer-events: none;
}

.contour-field img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-rule {
  position: absolute;
  z-index: 2;
  height: 1px;
  background: var(--rule-strong);
  transform-origin: left center;
}

.map-rule::after {
  content: "";
  position: absolute;
  right: -3px;
  top: -2px;
  width: 5px;
  height: 5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: var(--paper-light);
}

.marginal-note {
  position: absolute;
  z-index: 7;
  max-width: 190px;
  padding-left: 12px;
  border-left: 2px solid var(--clay);
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: 12px;
  font-style: italic;
  line-height: 1.55;
}

.record-slip {
  padding: 14px;
  border: 1px solid var(--rule-strong);
  background: rgba(247,242,231,.92);
}

.record-slip__date {
  margin-bottom: 9px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--clay);
}

.record-slip h3 {
  margin-bottom: 6px;
  font-size: 18px;
}

.record-slip p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.archive-tab {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  background: var(--botanical);
  color: var(--paper-light);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .1em;
}

.explanation-drawer {
  position: absolute;
  z-index: 10;
  right: 30px;
  bottom: 28px;
  width: min(360px, calc(100% - 60px));
  padding: 19px 20px 20px;
  border-top: 4px solid var(--clay);
  background: var(--ink);
  color: var(--paper-light);
  box-shadow: 0 16px 30px rgba(24,26,24,.24);
}

.explanation-drawer h3 {
  margin-bottom: 8px;
  font-size: 22px;
}

.explanation-drawer p {
  margin-bottom: 0;
  color: rgba(247,242,231,.78);
  font-size: 12px;
  line-height: 1.65;
}

.explanation-toggle,
.ripple-replay {
  appearance: none;
  border: 1px solid var(--ink);
  padding: 9px 12px;
  background: transparent;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
}

.explanation-toggle:hover,
.ripple-replay:hover {
  background: var(--ink);
  color: var(--paper-light);
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  background: rgba(247,242,231,.7);
}

.legend-key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
}

.legend-key::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 1px solid var(--ink);
}

.legend-key--place::before {
  background: var(--mineral);
}

.legend-key--person::before {
  border-radius: 50%;
  background: var(--botanical);
}

.legend-key--event::before {
  transform: rotate(45deg);
  background: var(--clay);
}

.legend-key--object::before {
  background: var(--ochre);
  clip-path: polygon(50% 0, 100% 34%, 82% 100%, 18% 100%, 0 34%);
}

@media (max-width: 560px) {
  .explanation-drawer {
    right: 14px;
    bottom: 14px;
    width: calc(100% - 28px);
  }

  .map-label__name {
    font-size: 15px;
  }

  .marginal-note {
    font-size: 11px;
  }
}
