.weke3d {
  --weke3d-bg: #000;
  --weke3d-fg: #fff;
  position: relative;
  width: 100%;
  margin: 0 0 1.5em;
}
.weke3d__stage {
  position: relative;
  width: 100%;
  height: var(--weke3d-height, 500px);
  background: var(--weke3d-bg);
  border-radius: var(--weke3d-radius, 8px);
  overflow: hidden;
  touch-action: pan-y;
}
.weke3d--aspect .weke3d__stage {
  height: auto;
  aspect-ratio: var(--weke3d-aspect, 1 / 1);
}
.weke3d__canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  cursor: grab;
  touch-action: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.weke3d__canvas:active { cursor: grabbing; }
.weke3d[data-state="ready"] .weke3d__canvas { opacity: 1; }

.weke3d__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.weke3d[data-state="ready"] .weke3d__poster { opacity: 0; }

.weke3d__start {
  z-index: 2;
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font: inherit;
  font-size: 15px;
  color: var(--weke3d-fg);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.weke3d__start:hover { background: rgba(0, 0, 0, 0.8); }
.weke3d[data-state="idle"] .weke3d__start { display: inline-flex; }

.weke3d__message {
  z-index: 2;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--weke3d-fg);
  font-size: 14px;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
.weke3d[data-state="loading"] .weke3d__message::before {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto 10px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: weke3d-spin 0.9s linear infinite;
}
@keyframes weke3d-spin { to { transform: rotate(360deg); } }
.weke3d[data-state="ready"] .weke3d__message { display: none; }

.weke3d__tools {
  z-index: 2;
  position: absolute;
  top: 10px;
  right: 10px;
  display: none;
  gap: 6px;
}
.weke3d[data-state="ready"] .weke3d__tools { display: flex; }
.weke3d__tools button {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--weke3d-fg);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  cursor: pointer;
}
.weke3d__tools button:hover { background: rgba(0, 0, 0, 0.75); }
.weke3d__tools svg { width: 18px; height: 18px; }

.weke3d__hint {
  z-index: 2;
  position: absolute;
  left: 12px;
  bottom: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  pointer-events: none;
  display: none;
}
.weke3d[data-state="ready"] .weke3d__hint { display: block; animation: weke3d-fade 6s forwards; }
@keyframes weke3d-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

.weke3d__caption {
  margin-top: 0.5em;
  font-size: 0.9em;
  opacity: 0.8;
  text-align: center;
}

.weke3d:fullscreen .weke3d__stage,
.weke3d:-webkit-full-screen .weke3d__stage {
  height: 100vh;
  aspect-ratio: auto;
  border-radius: 0;
}
.weke3d:fullscreen .weke3d__caption { display: none; }

/* Inactive viewer: still image of where it was left; click to make it live again. */
.weke3d__snapshot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  z-index: 1;
  display: none;
  cursor: pointer;
}
.weke3d[data-state="paused"] .weke3d__snapshot[src] { display: block; }
.weke3d[data-state="paused"] .weke3d__poster { opacity: 0; }
