···144144145145 const cosH = cos(hingeAngle), sinH = sin(hingeAngle);
146146147147- // Lid in local space: extends DOWN from y=0, same as base
148148- // y: 0 to lidThick, z: gap to 2*hd (gap keeps hinge edges from touching)
149149- // At 180°: y flips → extends UP (flush with base top), z flips → extends behind
147147+ // Lid in local space: extends UP from y=0 (negative y)
148148+ // At 180° (cos=-1): y flips sign → extends DOWN (positive y, same as base)
149149+ // Both halves flat and co-planar, both extending downward from y=0
150150 const lidLocal = [
151151 [-hw, 0, gap], [hw, 0, gap],
152152- [hw, lidThick, gap], [-hw, lidThick, gap],
152152+ [hw, -lidThick, gap], [-hw, -lidThick, gap],
153153 [-hw, 0, 2 * hd], [hw, 0, 2 * hd],
154154- [hw, lidThick, 2 * hd], [-hw, lidThick, 2 * hd],
154154+ [hw, -lidThick, 2 * hd], [-hw, -lidThick, 2 * hd],
155155 ];
156156157157 // Rotate lid around pivot (y=0, z=0 in local = pivot point)