.morality-3d main{max-width:1320px;padding:12px 30px;height:auto;min-height:calc(100vh - 65px)}
.morality-3d #app>section{height:auto;min-height:0;display:block}
.morality-3d .hero{margin:12px auto}
.morality-3d .welcome-layout{display:grid!important;grid-template-columns:1.45fr 1fr;gap:30px;align-items:center}
.morality-3d .welcome-copy .notice{margin:10px 0;font-size:13px}
.morality-3d .welcome-copy h1{font-size:28px;margin:5px 0}
.morality-3d .welcome-copy .lead{font-size:16px;line-height:1.65}
.morality-3d .welcome-copy .rule{display:none}
.morality-3d .page-heading h2{margin:4px 0 8px;font-size:25px}
.morality-3d .page-heading p{font-size:14px;line-height:1.65;margin:4px 0}
.morality-3d .actions,.morality-3d .page-actions{display:flex;justify-content:flex-end;margin-top:12px;gap:12px}
.morality-3d .trial-heading h2{font-size:19px;line-height:1.5;margin:2px 0 6px}
.morality-3d .trial-heading p{font-size:14px;margin:4px 0}
.spatial-room{position:relative;color:#26354a}
.spatial-room .observe-note{font-size:14px;line-height:1.5;margin:6px 0}
.spatial-room .controls{display:flex;justify-content:flex-end;margin:4px 0}
.spatial-room .controls button{font-size:14px;padding:7px 14px}
.spatial-room .scene{height:clamp(280px,calc(100vh - 345px),570px);position:relative;overflow:hidden;background:#fff;border-radius:10px;touch-action:none}
.spatial-room canvas{width:100%;height:100%;display:block}
.spatial-room .targets{pointer-events:none}
.spatial-room .hit{position:absolute;width:28px;height:28px;min-height:0;border:0;border-radius:50%;padding:0;background:transparent!important;transform:translate(-50%,-50%);pointer-events:auto}
.spatial-room .hit:hover,.spatial-room .hit:focus-visible{outline:2px solid #b8c7d4;outline-offset:1px}
.spatial-room .word{font-size:24px;letter-spacing:1px;color:#b78a00;pointer-events:none;z-index:2;max-width:32%;white-space:normal;text-align:center;line-height:1.5}
.spatial-room .word.top{top:8px}.spatial-room .word.bottom{bottom:8px}.spatial-room .word.left{left:14px}.spatial-room .word.right{right:14px}
.spatial-room .result{color:#a66b00;font-size:18px;font-weight:700;line-height:1.6;margin:5px 0;min-height:29px}
.spatial-room [hidden]{display:none!important}
.morality-3d .trial-footer{display:flex;justify-content:flex-end;align-items:center;padding-top:8px;min-height:48px;gap:18px}
.morality-3d .trial-footer #choice-status{margin-left:auto;font-size:13px}
.morality-3d .progress{margin-top:8px}
.morality-3d .demo-tabs{display:flex;gap:12px;justify-content:flex-end;margin:10px 0}
.morality-3d .demo-tabs button{font-size:14px;padding:8px 12px}
.morality-3d .spatial-reference .scene{height:clamp(230px,calc(100vh - 422px),480px)}
.morality-3d .welcome-copy .scene{height:clamp(210px,calc(100vh - 475px),350px)}
.morality-3d .welcome-copy .observe-note{font-size:12px}
.morality-3d .welcome-copy .result{font-size:18px}
.morality-3d .instructions{font-size:17px;margin:20px 0;line-height:1.8}

/* 3.1: equal 32px stimulus-to-point clearance, with positioning owned by the renderer. */
.spatial-room .word{max-width:none;white-space:nowrap;line-height:1.5}
.spatial-room .word.long-word{font-size:16px;letter-spacing:0}
.spatial-room .result{background:#ececef;color:#282132;font-size:16px;font-weight:400;line-height:1.6;padding:5px 10px;border-radius:5px}
.spatial-room .result mark{background:#fff200;color:#282132;padding:1px 3px;font-weight:600}
.morality-3d .welcome-copy .result{font-size:16px}
.morality-3d .comprehension-question{margin:10px 0;padding:9px 14px}
.morality-3d .comprehension-options{gap:7px 18px}

/* 3.2: square scene, external stimulus centres at equal cardinal radii. */
.spatial-room .spatial-field{--square-side:clamp(220px,calc(100vh - 422px),480px);position:relative;width:100%;height:var(--square-side);margin:8px auto}
.spatial-room .spatial-field.has-stimulus{--square-side:clamp(200px,calc(100vh - 540px),430px);height:calc(var(--square-side) + 240px)}
.morality-3d .spatial-room .spatial-field .scene{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:var(--square-side);height:var(--square-side);aspect-ratio:1;border-radius:6px;overflow:hidden;background:#fff}
.morality-3d .welcome-copy .spatial-field{--square-side:clamp(210px,calc(100vh - 475px),350px)}
.spatial-room .spatial-field .word{display:flex;align-items:center;justify-content:center;width:140px;height:54px;max-width:none;white-space:normal;overflow-wrap:anywhere;line-height:1.5;margin:0;transform:translate(-50%,-50%)}
.spatial-room .spatial-field .word.top,.spatial-room .spatial-field .word.bottom{left:50%}

/* v3.4: one font size for every target word and screen position. */
.morality-3d .spatial-room .spatial-field .word,
.morality-3d .spatial-room .spatial-field .word.long-word{font-size:24px!important;line-height:1.1!important;letter-spacing:0!important}
.morality-3d .spatial-room .spatial-field .word[data-attention="true"]{font-size:12px!important;line-height:1.15!important}
.morality-3d .spatial-reference .reference-item{position:relative;padding-left:18px;margin:7px 0;}
.morality-3d .spatial-reference .reference-item::before{content:"•";position:absolute;left:2px;color:#63399f;font-weight:700;}
.morality-3d .instruction-emphasis{background:#fff200;color:inherit;padding:1px 3px;font-weight:700;}

.morality-3d .spatial-room .spatial-field .word{height:54px;}

.morality-3d .repeat-direction-note{font-size:14px;line-height:1.5;margin:0 0 10px;color:#282132;}

/* v3.7: use laptop width for instructions, reserving height for the 3D scene. */
.morality-3d main{max-width:1480px;padding:12px 24px;}
.morality-3d .spatial-field:not(.has-stimulus){--square-side:clamp(300px,calc(100vh - 350px),540px);}
.morality-3d .welcome-copy .spatial-field{--square-side:clamp(250px,calc(100vh - 440px),390px);}
@media(min-width:960px){
 .morality-3d #app>section.combined-trial{display:grid!important;container-type:inline-size;grid-template-columns:250px minmax(0,1fr);grid-template-rows:auto auto auto auto 1fr auto auto;column-gap:24px;align-items:start;}
 .morality-3d .combined-trial>.trial-heading{grid-column:1;grid-row:1;text-align:left;}
 .morality-3d .combined-trial>.trial-heading h2{font-size:18px;line-height:1.5;}
 .morality-3d .combined-trial>.repeat-direction-note{grid-column:1;grid-row:2;margin:12px 0;}
 .morality-3d .combined-trial>.spatial-room{display:contents;}
 .morality-3d .combined-trial>.spatial-room>.observe-note{grid-column:1;grid-row:3;margin:8px 0;}
 .morality-3d .combined-trial>.spatial-room>.controls{grid-column:1;grid-row:4;justify-content:flex-start;margin:8px 0;}
 .morality-3d .combined-trial>.spatial-room>.result{grid-column:1;grid-row:5;margin:8px 0;}
 .morality-3d .combined-trial>.spatial-room>.spatial-field{grid-column:2;grid-row:1 / 6;--square-side:min(540px,max(280px,calc(100vh - 408px)),calc(100cqw - 598px));height:calc(var(--square-side) + 240px);margin:0 auto;}
 .morality-3d .combined-trial>.trial-footer{grid-column:1 / -1;grid-row:6;margin-top:8px;}
 .morality-3d .combined-trial>.progress{grid-column:1 / -1;grid-row:7;}
}

/* Combined coordinates: shared layout for instructions, checks and trials. */
.morality-3d .spatial-reference .reference-item::before{content:'▸';font-size:15px;color:#63399f}
.morality-3d .coordinate-layout{display:grid;grid-template-columns:minmax(0,1fr) 290px;gap:22px;align-items:start;margin:10px 0;container-type:inline-size}
.morality-3d .coordinate-layout>.spatial-room{min-width:0}
.morality-3d .coordinate-layout>.spatial-room>.observe-note{font-size:13px;margin:0 0 4px}
.morality-3d .coordinate-layout .spatial-field.has-stimulus{--square-side:min(440px,max(220px,calc(100vh - 610px)),calc(100cqw - 552px));height:calc(var(--square-side) + 240px);margin:0}
.morality-3d .coordinate-panel{background:#fff;border:1px solid #e1d9eb;border-radius:10px;padding:12px;min-width:0}
.morality-3d .coordinate-panel h3{font-size:17px;margin:0 0 4px}
.morality-3d .coordinate-caption,.morality-3d .coordinate-hint{font-size:12px;line-height:1.45;margin:5px 0;color:#635a6d;overflow-wrap:anywhere}
.morality-3d .coordinate-panel .coordinate-preview .scene{width:100%;height:auto;aspect-ratio:1;position:relative;transform:none;max-width:260px;margin:auto}
.morality-3d .coordinate-panel .reset,.morality-3d .coordinate-clear{font-size:12px;min-height:0;padding:4px 9px;margin-top:5px}
.morality-3d .coordinate-values{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:10px 0}
.morality-3d .coordinate-value{background:#f6f3f9;border:1px solid #e9e0f0;border-radius:6px;text-align:center;padding:6px 2px;font-size:12px}
.morality-3d .coordinate-value strong{display:block;font-size:20px;color:#63399f;margin:4px 0}
.morality-3d .coordinate-value button{font-size:12px;padding:3px 6px;min-height:0}
.morality-3d .coordinate-page .trial-heading h2{font-size:18px}
.morality-3d .coordinate-page .trial-heading p{font-size:13px;line-height:1.5}
.morality-3d .coordinate-page>.repeat-direction-note{margin:4px 0;font-size:13px}
.morality-3d .coordinate-page .result{font-size:14px;line-height:1.5;min-height:0}
@media(max-width:1100px){.morality-3d .coordinate-layout{grid-template-columns:minmax(0,1fr) 245px;gap:12px}.morality-3d .coordinate-layout .spatial-field.has-stimulus{--square-side:min(360px,max(180px,calc(100vh - 620px)),calc(100cqw - 497px))}.morality-3d .coordinate-value strong{font-size:17px}}

/* Keep the main scene legible on short laptop viewports. Let the page scroll vertically. */
.morality-3d .coordinate-layout {
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
}
.morality-3d .coordinate-layout .spatial-field {
  --square-side: min(470px, max(390px, calc(100vh - 260px)), calc(100cqw - 276px));
}
.morality-3d .coordinate-layout .spatial-field.has-stimulus {
  /* Two word boxes and the existing 92px offset from the scene edge. */
  --square-side: min(470px, max(390px, calc(100vh - 260px)), calc(100cqw - 596px));
  height: calc(var(--square-side) + 240px);
}
@media (max-width: 1100px) {
  .morality-3d .coordinate-layout {
    grid-template-columns: minmax(0, 1fr) 225px;
    gap: 12px;
  }
  .morality-3d .coordinate-layout .spatial-field.has-stimulus {
    --square-side: min(440px, max(390px, calc(100vh - 260px)), calc(100cqw - 557px));
  }
}
@media (max-height: 760px) {
  .morality-3d .coordinate-panel .coordinate-preview .scene {
    max-width: 174px;
  }
}

/* Keep the entire response interface in view during practice and formal trials. */
body.morality-3d:has(.trial.coordinate-page) {
  display: flex;
  flex-direction: column;
  height: 100svh;
}
body.morality-3d:has(.trial.coordinate-page) > header {
  height: 34px;
  flex: none;
}
body.morality-3d:has(.trial.coordinate-page) #icp-footer {
  padding: 0 !important;
}
.morality-3d #app:has(> .trial.coordinate-page) {
  display: flex;
  flex: 1 1 auto;
  margin: 0 auto;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  padding: 4px 14px;
}
.morality-3d #app > .trial.coordinate-page {
  display: grid;
  flex: 1;
  grid-template-rows: minmax(0, 1fr) auto 3px;
  gap: 3px;
}
.morality-3d .trial .coordinate-layout {
  --left-column: clamp(206px, 17vw, 250px);
  --right-column: clamp(190px, 16vw, 240px);
  display: grid;
  grid-template-columns: var(--left-column) minmax(0, 1fr) var(--right-column);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
  margin: 0;
  container-type: size;
}
.morality-3d .trial .coordinate-layout > .spatial-room {
  display: contents;
}
.morality-3d .trial-instructions {
  align-self: center;
  min-width: 0;
  padding: 2px 4px;
  overflow-wrap: anywhere;
}
.morality-3d .trial-instructions .trial-heading {
  text-align: left;
}
.morality-3d .trial-instructions .trial-heading h2 {
  margin: 0 0 7px;
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.35;
}
.morality-3d .trial-instructions p,
.morality-3d .trial-instructions .observe-note,
.morality-3d .trial-instructions .result {
  margin: 6px 0;
  font-size: 13px;
  line-height: 1.38;
}
.morality-3d .trial-instructions .controls {
  justify-content: flex-start;
}
.morality-3d .trial-instructions .controls button {
  padding: 5px 8px;
  font-size: 12px;
}
.morality-3d .trial .coordinate-layout .spatial-field.has-stimulus {
  --word-offset: 35px;
  --square-side: min(470px, max(390px, calc(100vh - 260px)), calc(100cqh - 70px), calc(100cqw - 596px));
  height: 100%;
  min-width: 0;
}
@media (max-width: 1100px) {
  .morality-3d .trial .coordinate-layout .spatial-field.has-stimulus {
    --square-side: min(440px, max(390px, calc(100vh - 260px)), calc(100cqh - 70px), calc(100cqw - 557px));
  }
}
.morality-3d .trial .spatial-field .word {
  width: clamp(86px, calc((100cqw - var(--left-column) - var(--right-column) - 20px - var(--square-side)) / 2 + 20px), 140px);
}
.morality-3d .trial .coordinate-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
  padding: 4px 8px;
}
.morality-3d .trial .coordinate-preview-heading {
  align-self: end;
  padding-bottom: 29px;
}
.morality-3d .trial .coordinate-preview .scene {
  max-width: clamp(100px, calc(100svh - 438px), 170px);
}
.morality-3d .trial .coordinate-preview .reset {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  margin: 0;
}
.morality-3d .trial .coordinate-preview-controls {
  align-self: start;
}
.morality-3d .trial .coordinate-panel .coordinate-hint,
.morality-3d .trial .coordinate-panel .coordinate-caption {
  margin: 3px 0;
  line-height: 1.25;
}
.morality-3d .trial .coordinate-values {
  margin: 4px 0;
  gap: 4px;
}
.morality-3d .trial .coordinate-value {
  padding: 3px 1px;
  font-size: 11px;
}
.morality-3d .trial .coordinate-value strong {
  margin: 1px 0;
  font-size: 16px;
}
.morality-3d .trial .coordinate-value button {
  font-size: 11px;
  padding: 2px 4px;
}
.morality-3d .trial .trial-footer {
  min-height: 0;
  padding-top: 3px;
}
.morality-3d .trial .trial-footer button {
  padding: 7px 15px;
}
.morality-3d .trial .progress {
  margin: 0;
}

@media (max-height: 600px) {
  .morality-3d .trial-instructions p,
  .morality-3d .trial-instructions .observe-note,
  .morality-3d .trial-instructions .result {
    margin: 4px 0;
    font-size: 12px;
    line-height: 1.3;
  }
}
.morality-3d .trial .spatial-field .word.top,
.morality-3d .trial .spatial-field .word.bottom {
  width: min(320px, var(--square-side));
}
