.cd-wrapper {
  position: relative;
  overflow: hidden;
  width: 100svw;
  height: 100svh;

  background: #111;
  background-image: url(../img/bg.png);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

}

.cd-loader {
  position: fixed;
  inset: 0;
  height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.cd-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  animation: cd-spin 0.8s linear infinite;
}

@keyframes cd-spin {
  to { transform: rotate(360deg); }
}

.cd-viewport {
  width:  100svw;
  height: 100svh;
  overflow: hidden;
  position: relative;
  cursor: grab;
}

.cd-viewport.dragging {
  cursor: grabbing;
}

.cd-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  /* width / height は JS で img.naturalWidth/Height px に設定 */
}

.cd-canvas > img {
  display: block;
  width: max-width;
  height: auto;
  aspect-ratio: 2600 / 1900;
  object-fit: contain;
  max-width: none;
  max-height: none;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0;
}

.cd-chara {
  position: absolute;
  cursor: pointer;
  opacity: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.cd-tip {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  cursor: pointer;
}

.cd-tip.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.cd-tip img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cd-zoom-controls {
  position: fixed;
  bottom: 64px;
  right: 0px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.cd-zoom-controls button {
  width: 48px;
  height: 48px;
  border: none;
  /* border: 2px solid rgba(255, 255, 255, 0.4); */
  /* border-radius: 50%; */
  background: #272727;
  color: var(--vivant-color-primary);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s, opacity 0.15s, color 0.15s;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.cd-zoom-controls button:disabled {
  color: #000;
  cursor: default;
}

@media (hover: hover) {
  .cd-zoom-controls button:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.2);
  }
}
