/* Compact play keeps one complete camera above its two control rows. The
   viewport controller measures text/notice height before fitting that camera. */
@media(max-width:850px) and (max-aspect-ratio:11/10),(max-width:599px){
 body.play-screen:not(.play-wide) .play-stage{
  margin:0;
  align-content:start;
 }
 body.play-screen:not(.play-wide) #field-wrap{
  align-items:flex-start;
  justify-content:center;
  padding:0;
 }
 body.play-screen:not(.play-wide) #canvas{
  margin:0;
 }

 /* An extra tool gets its own row instead of squeezing the existing labels.
    In particular, Opastus/Spielhilfe/Orientação remain complete words. */
 body.play-screen:not(.play-wide) #puzzle-actions{
  display:grid;
  grid-template-columns:minmax(56px,1fr) minmax(44px,.8fr) minmax(72px,1.15fr) minmax(48px,.8fr) 44px;
  gap:3px;
  align-items:stretch;
  margin:0;
  padding:3px;
  min-height:50px;
  flex:none;
 }
 body.play-screen:not(.play-wide) #puzzle-actions>button{
  width:100%;
  min-width:0;
  min-height:44px;
  margin:0;
  padding:4px 3px;
  font-size:11px;
  line-height:1.2;
  white-space:normal;
  overflow-wrap:normal;
  word-break:normal;
  hyphens:none;
 }
 body.play-screen:not(.play-wide) #puzzle-actions>#undo-v5{grid-column:1}
 body.play-screen:not(.play-wide) #puzzle-actions>#pause-button{grid-column:2}
 body.play-screen:not(.play-wide) #puzzle-actions>#campaign-help{grid-column:3}
 body.play-screen:not(.play-wide) #puzzle-actions>#help-button{grid-column:4}
 body.play-screen:not(.play-wide) #puzzle-actions>#play-tools-button{grid-column:5;font-size:18px}
 body.play-screen:not(.play-wide) #puzzle-actions>#blast-v5{
  grid-column:1/-1;
  grid-row:1;
  min-width:0;
 }
 body.play-screen:not(.play-wide) #puzzle-actions:has(>#blast-v5:not([hidden]))>button:not(#blast-v5){grid-row:2}

 /* Status copy is part of the measured chrome, never a fixed-height crop. */
 body.play-screen:not(.play-wide) #failure-notice{
  flex:none;
  margin:3px 5px;
  padding:6px 8px!important;
  font-size:12px!important;
  line-height:1.35;
  max-height:none;
  overflow:visible;
  overflow-wrap:normal;
 }

 /* The bubble's decorative triangle used to paint over its first letters.
    Its isolated layer now sits below the actual copy, outside the padding. */
 body.play-screen:not(.play-wide) #play-sidebar .coach{
  padding:0 6px;
  height:auto;
  max-height:none;
  overflow:visible;
 }
 body.play-screen:not(.play-wide) #play-sidebar .coach #play-speaker{
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:12px;
  width:100%;
  min-width:0;
  margin:0;
  padding:3px 0;
 }
 body.play-screen:not(.play-wide) #play-sidebar #quip-heckler{
  flex:0 0 40px;
  width:40px;
  height:48px;
  margin:0;
 }
 body.play-screen:not(.play-wide) #play-sidebar #play-quip{
  position:relative;
  isolation:isolate;
  flex:1 1 0;
  width:auto;
  min-width:0;
  max-width:100%;
  height:auto;
  max-height:none;
  overflow:visible;
  margin:0;
  padding:9px 12px!important;
  text-indent:0;
  font-size:12px!important;
  line-height:1.35;
  white-space:normal;
  overflow-wrap:normal;
  word-break:normal;
 }
 body.play-screen:not(.play-wide) #play-sidebar #play-quip::before{
  z-index:-1;
  left:-7px;
  right:auto;
  top:calc(50% - 6px);
  bottom:auto;
  width:12px;
  height:12px;
  border:0;
  border-left:1px solid #c8ac63;
  border-bottom:1px solid #c8ac63;
  transform:rotate(45deg);
 }
 body.play-screen:not(.play-wide).large-text #play-sidebar #play-quip{font-size:15px!important}
 body.play-screen:not(.play-wide).large-text #puzzle-actions>button{font-size:13px}
}

/* More actions uses the same existing handlers, grouped by the decision the
   player is making. Changing a puzzle is separate from ending this attempt. */
.play-tools-panel{gap:16px;max-width:540px}
.play-tools-paused{margin:0;font-size:13px;line-height:1.45;color:#65705a}
.play-tools-group{display:grid;gap:6px;min-width:0}
.play-tools-group h3{margin:0 0 2px;font-size:15px;line-height:1.3;color:#315c49}
.play-tools-panel .play-tools-group .action{
 display:flex;
 flex-direction:column;
 align-items:flex-start;
 justify-content:center;
 gap:4px;
 width:100%;
 min-width:0;
 min-height:48px;
 margin:0;
 padding:10px 12px;
 text-align:left;
 white-space:normal;
 overflow-wrap:normal;
 word-break:normal;
}
.play-tools-group .action strong{font-size:14px;line-height:1.3}
.play-tools-group .action small{font-size:12px;line-height:1.4;font-weight:500;opacity:1;color:inherit}
.play-tools-group [data-play-action="finish"]{background:#f4eddf}
.play-tools-group [data-play-action="skip-v5"]{background:#eef0df;border-color:#a4b48e}
@media(max-height:480px){
 .play-tools-panel{gap:12px}
 .play-tools-panel .play-tools-group .action{padding:8px 10px}
}

/* A short prologue connects puzzle rewards with the machine before part one. */
.machine-prologue{border:1px solid #b6bea1;border-radius:12px;background:#f4f1df;padding:12px;color:#284c3c;text-align:left}
.machine-prologue>strong{font-size:16px;line-height:1.25}
.machine-prologue p{font-size:13px;line-height:1.45;margin:7px 0}
.machine-prologue .small{min-height:44px;padding:7px 12px}
.home-controls>.machine-prologue{order:-2;margin-top:8px}
.machine-purpose{font-size:14px;line-height:1.5;background:#f4efdc;border-left:4px solid #8ba17b;padding:10px 12px;margin:10px 0}
#part-earned-purpose{font-size:14px;line-height:1.45;margin:8px 0}
#tutorial-modal-surface .hands-on-never:not([hidden]){display:flex;align-items:center;gap:8px;flex:1 1 100%;font-size:13px;line-height:1.35;min-height:44px;text-align:left}
#tutorial-modal-surface .hands-on-never input{width:20px;height:20px;flex:none;accent-color:#397b65}

/* Assembly is its own readable scene, not a translucent layer of the result. */
#story-modal{background:#17372be8}
#story-modal .modal-inner{background:#fffaf0;opacity:1;border:1px solid #bcb79b;border-radius:14px;max-height:calc(100dvh - 16px);overflow-y:auto;overscroll-behavior:contain}
#story-modal .modal-head{background:#fffaf0}
