.layout{
  grid-template-columns:minmax(340px,42%) minmax(0,1fr);
  min-height:0;
  height:clamp(620px,82vh,900px);
}
.editor{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(92px,29%);
  grid-template-rows:minmax(0,1fr);
  grid-template-areas:"workspace palette";
  gap:10px;
  min-height:0;
  padding:14px;
  background:#c8ddf2;
}
.editor .stack{
  min-height:0;
  max-height:none;
  margin:0;
  padding:10px 9px;
  border:2px solid #b49662;
  border-radius:7px;
  box-shadow:inset 0 0 0 3px #fff5d3;
  background:#fcf0cd;
  overscroll-behavior:contain;
  scrollbar-color:#9b8153 #f6e7bd;
  scrollbar-gutter:stable;
}
.editor .stack:empty::after{
  min-height:100%;
  color:#826b44;
}
.editor .block{
  flex-direction:row;
  justify-content:flex-start;
  gap:7px;
  width:100%;
  height:43px;
  padding:4px 8px;
  text-align:left;
}
.editor .block .command-icon{flex:0 0 25px;width:25px;height:25px}
.editor .block .command-label{font-size:.81rem}
.editor .palette{
  grid-area:palette;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:7px;
  min-height:0;
  overflow:auto;
  margin:0;
  padding:6px;
  border:2px solid #577b9e;
  background:#b6d2ee;
  border-radius:7px;
}
.editor .palette .command{flex:none;min-height:59px}
.playfield{container-type:inline-size;min-height:0;padding-inline:10px}
.playfield .board{
  --unit:min(var(--cell),calc((100cqw - (var(--cols) - 1) * var(--tile-gap))/var(--cols)));
}
@media(max-width:760px){
  .layout{grid-template-columns:minmax(270px,45%) minmax(0,1fr)}
  .editor{padding:8px;gap:6px}
}
@media(max-width:570px){
  .layout{grid-template-columns:minmax(0,1fr);height:auto}
  .playfield{grid-row:1;min-height:265px;padding-block:18px}
  .editor{min-height:560px;height:65vh;border-right:0;border-top:3px solid var(--rim)}
  .editor .block .command-label{font-size:.75rem}
}
.workspace{
  grid-area:workspace;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  min-height:0;
  padding:10px 8px 6px;
  border:2px solid #b49662;
  border-radius:8px;
  background:#fcf0cd;
  box-shadow:inset 0 0 0 3px #fff5d3;
}
.workspace .start-block{
  position:relative;
  z-index:1;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-height:56px;
  flex:none;
  align-self:stretch;
  margin:0 8px 8px;
  color:#163b2f;
  background:#a7eb9f;
  border:2px solid #315942;
  border-radius:7px 7px 5px 5px;
  box-shadow:inset 3px 3px #e4ffd1,0 4px #315942;
  font:700 clamp(1.18rem,2.5vw,1.85rem) Pixelify,ui-monospace,monospace;
}
.start-block::after{
  content:'';
  position:absolute;
  bottom:-7px;
  left:22px;
  width:23px;
  height:7px;
  background:#315942;
  border-radius:0 0 4px 4px;
}
.workspace .start-block:disabled{opacity:.85;cursor:default}
.workspace .stack{
  flex:1;
  overflow:auto;
  overflow-anchor:none;
  border:0;
  border-radius:0;
  box-shadow:none;
  background:transparent;
  padding:4px 8px 10px;
}
.workspace .stack.drop-ready{background:#fffae7}
.celebration{
  position:absolute;
  z-index:4;
  left:50%;
  bottom:14px;
  transform:translateX(-50%);
  max-width:calc(100% - 20px);
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:center;
  gap:8px 12px;
  width:max-content;
  padding:10px 14px;
  color:#263f6d;
  background:#fff1c9;
  border:3px solid #315942;
  box-shadow:0 4px #293d32;
  text-align:center;
}
.celebration strong{font:700 clamp(1.25rem,3vw,1.85rem) Pixelify,ui-monospace,monospace}
.celebration button{color:#173f2d;background:#a7eb9f;border-color:#315942;box-shadow:inset 2px 2px #e4ffd1,0 3px #315942}
.choices .portrait{image-rendering:auto}
