/*
 * The ViewCube, on its own because two pages draw it: the main viewer puts it
 * in its own corner, the xeokit-style test page puts it in the bottom-right
 * box the reference viewer keeps its nav cube in. The two differ only in the
 * box the host element is given, so the rules are the same.
 */

#viewcube, .navcube-host {
  position: fixed;
  top: 72px;
  right: calc(var(--rail-w) + 16px);
  width: 128px;
  height: 128px;
  z-index: 16;
  pointer-events: none;
}

#viewcube button, .navcube-host button { pointer-events: auto; }

/* 真 3D 导航立方：小 canvas 铺满宿主方块（测试页放在右下 200×200 里，
   主查看器放在右上 128×128 里），右下角的 "?" 是操作提示。 */
/* 宿主方块是 pointer-events:none（老的两版 ViewCube 只让里面的按钮收事件），
   这个 canvas 自己要收：拖动和点击都从它来。 */
.navcube-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  pointer-events: auto;
}
.navcube-canvas:active { cursor: grabbing; }

.navcube-help {
  position: absolute;
  right: -6px;
  top: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  color: #17427f;
  border: 1px solid #c8d0da;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  cursor: help;
  pointer-events: auto;
}

.vc-cube {
  position: absolute;
  inset: 14px;
  transform-style: preserve-3d;
  transition: transform 0.15s linear;
}

.vc-face, .vc-corner {
  position: absolute;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid #c8d0da;
  background: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  color: #46505f;
}

.vc-face.is-active, .vc-corner.is-active, .vc-dir.is-active {
  background: #dbe8ff;
  border-color: #9dbcf7;
  color: #17427f;
}

.vc-top { top: 0; left: 50%; transform: translateX(-50%); }
.vc-bottom { bottom: 0; left: 50%; transform: translateX(-50%); }
.vc-front { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.vc-back { top: 50%; left: 0; transform: translateY(-50%); }
.vc-right { top: 50%; right: 0; transform: translateY(-50%); }
.vc-left { top: 50%; left: 0; transform: translateY(-50%); }
.vc-corner { width: 12px; height: 12px; border-radius: 3px; opacity: 0.85; }
.vc-corner:nth-child(7) { top: 0; left: 0; }
.vc-corner:nth-child(8) { top: 0; right: 0; }
.vc-corner:nth-child(9) { bottom: 0; left: 0; }
.vc-corner:nth-child(10) { bottom: 0; right: 0; }
.vc-corner:nth-child(11), .vc-corner:nth-child(12),
.vc-corner:nth-child(13), .vc-corner:nth-child(14) { display: none; }

.vc-ring { position: absolute; inset: 0; }

.vc-dir {
  position: absolute;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  font-size: 10px;
  color: #46505f;
  background: rgba(255, 255, 255, 0.92);
}

.vc-ring-front { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.vc-ring-right { top: 50%; right: 0; }
.vc-ring-back { top: 0; left: 50%; transform: translateX(-50%); }
.vc-ring-left { top: 50%; left: 0; }
