/* JustiX 0.8.5.5 — Courtroom Spatial Layout / safe-area correction
   Keeps the approved navy/gold design while preventing 3D actors, labels,
   evidence panels and HUD from being clipped by the usable scene bounds. */

/* The stage is the clipping boundary; every critical overlay gets an internal safe area. */
.court-stage.mode-3d{
  --jx-scene-safe-x: 28px;
  --jx-scene-safe-bottom: 22px;
  overflow:hidden;
}

/* Do not enlarge the 3D world beyond the visible stage in the default camera. */
.court-stage.mode-3d .courtroom-3d-shell{
  inset:0!important;
  transform-origin:50% 60%!important;
}
.court-stage.mode-3d[data-camera="wide"] .courtroom-3d-shell{
  transform:perspective(1200px) rotateX(calc(4deg + var(--scene-rx))) rotateY(var(--scene-ry)) scale(.92)!important;
}

/* Camera presets retain the cinematic movement but never throw the opposite side out of frame. */
.court-stage.mode-3d[data-camera="judge"] .courtroom-3d-shell{
  transform:perspective(1080px) translate3d(0,34px,70px) rotateX(calc(2deg + var(--scene-rx))) rotateY(var(--scene-ry)) scale(1.00)!important;
}
.court-stage.mode-3d[data-camera="defence"] .courtroom-3d-shell{
  transform-origin:31% 62%!important;
  transform:perspective(1080px) translate3d(7%,14px,78px) rotateX(calc(3deg + var(--scene-rx))) rotateY(calc(-4deg + var(--scene-ry))) scale(1.02)!important;
}
.court-stage.mode-3d[data-camera="prosecution"] .courtroom-3d-shell{
  transform-origin:69% 62%!important;
  transform:perspective(1080px) translate3d(-7%,14px,78px) rotateX(calc(3deg + var(--scene-rx))) rotateY(calc(4deg + var(--scene-ry))) scale(1.02)!important;
}
.court-stage.mode-3d[data-camera="witness"] .courtroom-3d-shell{
  transform-origin:76% 40%!important;
  transform:perspective(1040px) translate3d(-10%,34px,92px) rotateX(calc(2deg + var(--scene-rx))) rotateY(calc(5deg + var(--scene-ry))) scale(1.04)!important;
}
.court-stage.mode-3d[data-camera="evidence"] .courtroom-3d-shell{
  transform-origin:24% 34%!important;
  transform:perspective(1040px) translate3d(10%,34px,92px) rotateX(calc(2deg + var(--scene-rx))) rotateY(calc(-5deg + var(--scene-ry))) scale(1.04)!important;
}

/* Participant safe positions.  The right-side lawyer and witness were the main clipping source. */
.court-stage.mode-3d .prosecution3d{right:19%!important}
.court-stage.mode-3d .defence3d{left:19%!important}
.court-stage.mode-3d .witness3d{right:11.5%!important}
.court-stage.mode-3d .prosecution-desk{right:8.5%!important;width:29%!important}
.court-stage.mode-3d .defence-desk{left:8.5%!important;width:29%!important}
.court-stage.mode-3d .witness-stand3d{right:7.5%!important;width:16%!important}

/* Actor labels are self-contained and cannot extend into the stage edge. */
.court-stage.mode-3d .actor3d > .actor-name{
  width:max-content!important;
  min-width:132px!important;
  max-width:178px!important;
  padding:9px 12px!important;
  white-space:normal!important;
  overflow:hidden!important;
  text-overflow:clip!important;
  overflow-wrap:anywhere!important;
  word-break:normal!important;
  line-height:1.25!important;
}
.court-stage.mode-3d .actor3d > .actor-name b,
.court-stage.mode-3d .actor3d > .actor-name span{
  display:block!important;
  max-width:100%!important;
  white-space:normal!important;
  overflow:visible!important;
  text-overflow:clip!important;
  overflow-wrap:anywhere!important;
  word-break:normal!important;
  text-align:center!important;
}
.court-stage.mode-3d .actor3d > .actor-name b{font-size:12px!important;line-height:1.2!important}
.court-stage.mode-3d .actor3d > .actor-name span{font-size:10px!important;line-height:1.3!important}

/* Evidence wall: keep the complete panel inside the left safe edge. */
.court-stage.mode-3d .evidence-screen3d{
  left:6.5%!important;
  width:20.5%!important;
  max-width:260px!important;
  min-width:150px!important;
  overflow:hidden!important;
}
.court-stage.mode-3d .evidence-screen3d > span,
.court-stage.mode-3d .evidence-screen3d > b,
.court-stage.mode-3d .evidence-screen3d > small{
  max-width:100%!important;
  overflow-wrap:anywhere!important;
  word-break:normal!important;
}

/* HUD status cards use the stage safe area and a controlled width. */
.court-stage.mode-3d .scene-speaker,
.court-stage.mode-3d .camera-status{
  max-width:min(260px,31%)!important;
  min-width:0!important;
  overflow:hidden!important;
}
.court-stage.mode-3d .scene-speaker{left:var(--jx-scene-safe-x)!important}
.court-stage.mode-3d .camera-status{right:var(--jx-scene-safe-x)!important}
.court-stage.mode-3d .scene-speaker > div,
.court-stage.mode-3d .camera-status > *{min-width:0!important}
.court-stage.mode-3d .scene-speaker b,
.court-stage.mode-3d .scene-speaker small,
.court-stage.mode-3d .camera-status b,
.court-stage.mode-3d .camera-status small{
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}

/* Keep the camera bar inside the actual stage instead of the transformed 3D world. */
.court-stage.mode-3d .court-3d-hud{
  left:var(--jx-scene-safe-x)!important;
  right:var(--jx-scene-safe-x)!important;
  width:auto!important;
  max-width:none!important;
  transform:none!important;
}

@media(max-width:1100px){
  .court-stage.mode-3d{--jx-scene-safe-x:20px}
  .court-stage.mode-3d .prosecution3d{right:17%!important}
  .court-stage.mode-3d .defence3d{left:17%!important}
  .court-stage.mode-3d .witness3d{right:10.5%!important}
  .court-stage.mode-3d .actor3d > .actor-name{min-width:120px!important;max-width:160px!important;padding:8px 10px!important}
  .court-stage.mode-3d .evidence-screen3d{left:5.5%!important;width:21%!important;min-width:136px!important}
}

@media(max-width:900px){
  .court-stage.mode-3d{--jx-scene-safe-x:16px}
  .court-stage.mode-3d .courtroom-3d-shell{inset:3% 0 0!important}
  .court-stage.mode-3d .prosecution3d{right:14%!important}
  .court-stage.mode-3d .defence3d{left:14%!important}
  .court-stage.mode-3d .witness3d{right:8%!important}
  .court-stage.mode-3d .actor3d > .actor-name{min-width:108px!important;max-width:145px!important;padding:7px 8px!important}
  .court-stage.mode-3d .actor3d > .actor-name b{font-size:11px!important}
  .court-stage.mode-3d .actor3d > .actor-name span{font-size:9px!important}
  .court-stage.mode-3d .evidence-screen3d{left:4%!important;width:23%!important;min-width:118px!important;padding:10px!important}
  .court-stage.mode-3d .scene-speaker,.court-stage.mode-3d .camera-status{max-width:34%!important}
}

@media(max-width:650px){
  .court-stage.mode-3d{--jx-scene-safe-x:12px}
  .court-stage.mode-3d .courtroom-3d-shell{inset:7% 0 0!important}
  .court-stage.mode-3d .prosecution3d{right:10%!important}
  .court-stage.mode-3d .defence3d{left:10%!important}
  .court-stage.mode-3d .witness3d{right:4.5%!important}
  .court-stage.mode-3d .prosecution-desk{right:2.5%!important;width:33%!important}
  .court-stage.mode-3d .defence-desk{left:2.5%!important;width:33%!important}
  .court-stage.mode-3d .witness-stand3d{right:1.5%!important;width:18%!important}
  .court-stage.mode-3d .actor3d > .actor-name{min-width:96px!important;max-width:126px!important;padding:6px 7px!important}
  .court-stage.mode-3d .actor3d > .actor-name b{font-size:10px!important}
  .court-stage.mode-3d .actor3d > .actor-name span{font-size:8px!important}
  .court-stage.mode-3d .evidence-screen3d{left:2.5%!important;width:24%!important;min-width:102px!important;padding:8px!important}
  .court-stage.mode-3d .scene-speaker,.court-stage.mode-3d .camera-status{max-width:40%!important}
}

@media(max-width:430px){
  .court-stage.mode-3d{--jx-scene-safe-x:8px}
  .court-stage.mode-3d .courtroom-3d-shell{inset:10% 0 0!important}
  .court-stage.mode-3d .prosecution3d{right:7%!important}
  .court-stage.mode-3d .defence3d{left:7%!important}
  .court-stage.mode-3d .witness3d{right:2%!important}
  .court-stage.mode-3d .actor3d > .actor-name{min-width:88px!important;max-width:112px!important;padding:5px 6px!important}
  .court-stage.mode-3d .actor3d > .actor-name b{font-size:9px!important}
  .court-stage.mode-3d .actor3d > .actor-name span{font-size:7.5px!important}
  .court-stage.mode-3d .evidence-screen3d{left:1.5%!important;width:25%!important;min-width:88px!important}
  .court-stage.mode-3d .scene-speaker,.court-stage.mode-3d .camera-status{max-width:42%!important}
}
