body.three-d { background: #0b0610; overflow: hidden; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#gl.dragging { cursor: grabbing; }
#gl.over { cursor: pointer; }

.chip {
  background: var(--paper); color: var(--ink); padding: 3px 9px; font-size: 13px; text-decoration: none;
  box-shadow: 2px 2px 0 var(--ink);
}
.chip:hover { background: var(--pink); }
.hud-top { position: fixed; top: 12px; left: 16px; right: 16px; z-index: 5; display: flex; gap: 10px; align-items: center; }
.hud-top .found { margin-left: auto; font-family: var(--marker); font-size: 16px; }
.hint3d {
  position: fixed; left: 50%; top: 52px; transform: translateX(-50%); z-index: 5; margin: 0;
  font-size: 13px; background: var(--paper); padding: 3px 9px; text-align: center; transition: opacity 1.2s;
}
.hud-sign { z-index: 5; }
.hud-nav { position: fixed; right: 16px; bottom: 16px; z-index: 5; display: flex; gap: 8px; }
.hud-nav .chip { font-family: var(--marker); font-size: 18px; }
.found-toast {
  position: fixed; left: 50%; top: 40%; z-index: 40; margin: 0; transform: translate(-50%, -50%) rotate(-4deg);
  font-family: var(--marker); font-size: clamp(28px, 6vw, 56px); color: var(--pink); text-shadow: 3px 3px 0 var(--ink);
  pointer-events: none; animation: pop 1.4s ease-out forwards;
}
@keyframes pop { 0% { transform: translate(-50%, -50%) scale(.3) rotate(-20deg); opacity: 0; } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(-4deg); } 100% { opacity: 0; transform: translate(-50%, -80%) scale(1) rotate(-4deg); } }

#viewer3d { position: fixed; inset: 0; z-index: 20; background: rgba(11, 6, 16, .93); display: grid; place-items: center; }
#viewer3d img { max-width: calc(100vw - 112px); max-height: calc(100vh - 110px); object-fit: contain; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
#viewer3d .close { position: absolute; top: 12px; right: 16px; font-size: 22px; color: var(--paper); }
#viewer3d .prev, #viewer3d .nxt { position: absolute; top: 50%; transform: translateY(-50%); font-size: 46px; padding: 10px; color: var(--paper); }
#viewer3d .prev { left: 8px; } #viewer3d .nxt { right: 8px; }
#viewer3d .tape { cursor: default; }

@media (max-width: 640px) {
  .hud-top { flex-wrap: wrap; }
  .hint3d { top: 84px; width: calc(100% - 32px); }
  .hud-sign { bottom: 64px; }
  #viewer3d img { max-width: calc(100vw - 16px); max-height: calc(100vh - 140px); }
}
