.container {
  display: grid;
  place-content: center;
  height: 100vh;
}

body {
  padding: 0;
}

ul {
  position: relative;
}

li {
  position: absolute;
  left: 50%;
  transform-origin: 50% 100%;
  box-sizing: border-box;
  transform:
  translateX(-50%)
  rotate(
    calc(
      (sibling-index() - (sibling-count() + 1) / 2) * 20deg
    )
  )
  translateY(-160px);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;

  /* カードの装飾スタイル */
  cursor: pointer;
  width: 152px;
  height: 208px;
  border-radius: 16px;
  display: grid;
  place-content: center;
  font-size: 40px;
  background: #fff;
  border: 1px solid #b6b6b6;
  outline: none;
}

li:focus-within {
  z-index: 1;
}

li:hover {
  z-index: 1;
  transform:
  translateX(-50%)
  rotate(
    calc(
      (sibling-index() - (sibling-count() + 1) / 2) * 20deg
    )
  )
  translateY(-180px)
    scale(1.05);
  box-shadow: 0 18px 40px rgba(0,0,0,.20);
}

.card-label {
  pointer-events: none;
}

/* 削除ボタン */
.card-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #c2c2c2;
  background: #fff;
  color: #333;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform: scale(0.95);

  &:hover {
    background: #f0f0f0;
  }
}

@media (max-width: 600px) {
  body {
    padding: 0px;
  }
  ul {
    width: 320px;
    height: 320px;
    margin: 0 auto;
    transform: rotate(90deg);
    transform-origin: 50% 50%;
  }

  li {
    transform:
    translateX(-50%)
    rotate(
      calc(
        (sibling-index() - (sibling-count() + 1) / 2) * 20deg
      )
    )
    translateY(-160px)
  }

  li:hover {
    transform:
    translateX(-50%)
    rotate(
      calc(
        (sibling-index() - (sibling-count() + 1) / 2) * 20deg
      )
    )
    translateY(-180px)
    scale(1.05)
  }
}



li:hover .card-remove,
li:focus-within .card-remove,
.card-remove:focus-visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}
