.treasure-panel {
  overflow: hidden;
}

.treasure-list {
  display: grid;
  gap: 12px;
}

.treasure-section {
  border: 1px solid rgba(234, 196, 91, .18);
  border-radius: 8px;
  background: rgba(5, 10, 8, .78);
  overflow: hidden;
}

.treasure-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}

.treasure-title {
  margin: 0;
  color: #fff8df;
  font-size: 16px;
  font-weight: 950;
}

.treasure-note {
  margin-top: 5px;
  color: rgba(238, 246, 237, .68);
  font-size: 12px;
  line-height: 1.45;
}

.treasure-body {
  display: block;
  padding: 0 14px 14px;
}

.treasure-section.collapsed .treasure-body {
  display: none;
}

.treasure-map-visual {
  position: relative;
  aspect-ratio: var(--treasure-ratio, 16 / 9);
  min-height: 260px;
  border: 1px solid rgba(234, 196, 91, .2);
  border-radius: 7px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(5, 9, 8, .08), rgba(5, 9, 8, .22)),
    var(--map-image) center / cover,
    rgba(7, 12, 12, .9);
}

.treasure-map-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 55%, rgba(0, 0, 0, .12) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, .01), rgba(0, 0, 0, .14));
  pointer-events: none;
}

.treasure-marker {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 1;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: end center;
  transform: translate(-50%, -50%);
  border: 0;
  background: url("assets/treasure-chest.webp") center / contain no-repeat;
  color: #171007;
  cursor: pointer;
  filter:
    drop-shadow(0 0 10px rgba(255, 204, 85, .42))
    drop-shadow(0 10px 14px rgba(0, 0, 0, .45));
}

.treasure-marker::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 12px;
  border: 1px solid rgba(255, 232, 146, .58);
  box-shadow: 0 0 0 5px rgba(234, 196, 91, .11);
  pointer-events: none;
}

.treasure-marker.hot {
  filter:
    drop-shadow(0 0 14px rgba(255, 61, 48, .9))
    drop-shadow(0 12px 18px rgba(0, 0, 0, .5));
}

.treasure-marker.hot::before {
  border-color: rgba(255, 88, 72, .95);
  box-shadow:
    0 0 0 6px rgba(255, 61, 48, .2),
    0 0 22px rgba(255, 61, 48, .7);
}

.treasure-marker-no {
  position: relative;
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  margin-bottom: -2px;
  border-radius: 999px;
  background: rgba(255, 230, 145, .96);
  color: #180f06;
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .48);
}

.treasure-marker.hot .treasure-marker-no {
  background: #ff3d30;
  color: #fff;
}

.treasure-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.treasure-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(234, 196, 91, .2);
  border-radius: 6px;
  padding: 6px 8px;
  background: rgba(7, 14, 12, .72);
  color: #f7fff7;
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.treasure-legend-item:hover {
  border-color: rgba(255, 224, 140, .48);
  background: rgba(16, 26, 19, .86);
}

.treasure-legend-no {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(234, 196, 91, .88);
  color: #171007;
  font-size: 11px;
  font-weight: 950;
}

.treasure-legend-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.treasure-copy {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(234, 196, 91, .36);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .03)),
    rgba(12, 16, 12, .6);
  color: #fff5d5;
  font-weight: 850;
}

.treasure-preview {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(8px);
}

.treasure-preview.show {
  display: flex;
}

.treasure-preview-card {
  width: min(760px, 96vw);
  max-height: 90vh;
  overflow: hidden;
  border: 1px solid rgba(234, 196, 91, .28);
  border-radius: 8px;
  background: rgba(5, 11, 9, .96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .62);
}

.treasure-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(234, 196, 91, .18);
  color: #fff8df;
  font-weight: 900;
}

.treasure-preview-close {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 6px;
  background: rgba(255, 255, 255, .06);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.treasure-preview-map {
  position: relative;
  aspect-ratio: var(--preview-ratio, 16 / 9);
  min-height: 320px;
  max-height: calc(90vh - 58px);
  background:
    linear-gradient(180deg, rgba(5, 9, 8, .03), rgba(5, 9, 8, .18)),
    var(--preview-map) center / cover no-repeat,
    rgba(0, 0, 0, .35);
}

.treasure-preview-map .treasure-marker {
  width: 58px;
  height: 58px;
  z-index: 2;
  pointer-events: none;
}

.treasure-preview-map::after {
  content: "";
  position: absolute;
  left: var(--preview-x, 50%);
  top: var(--preview-y, 50%);
  width: 112px;
  height: 112px;
  border: 2px solid rgba(255, 72, 54, .9);
  border-radius: 999px;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 0 999px rgba(0, 0, 0, .24),
    0 0 28px rgba(255, 72, 54, .7);
  pointer-events: none;
}

.treasure-preview-tip {
  position: absolute;
  left: var(--preview-x, 50%);
  top: calc(var(--preview-y, 50%) + 66px);
  z-index: 3;
  transform: translateX(-50%);
  padding: 6px 10px;
  border: 1px solid rgba(255, 224, 140, .42);
  border-radius: 6px;
  background: rgba(6, 10, 8, .86);
  color: #fff8df;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 12px 24px rgba(0, 0, 0, .42);
}

@media (max-width: 620px) {
  .treasure-head {
    padding: 10px 11px;
  }

  .treasure-body {
    padding: 10px;
  }

  .treasure-marker {
    width: 30px;
    height: 30px;
  }

  .treasure-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .treasure-legend-item {
    min-height: 32px;
    padding: 6px;
    font-size: 11px;
  }
}
