/* Shared landscape workspace for lessons and both Create editors. */
main, .studio-footer {
  width: min(100%, 1480px);
  max-width: 1480px;
  padding-inline: max(18px, env(safe-area-inset-left)) max(18px, env(safe-area-inset-right));
}
.heading, main > header {
  height: 72px;
  flex: 0 0 72px;
  margin: 0;
  padding-block: 4px;
  align-items: center;
}
.level-picker { width: clamp(240px, 36vw, 420px); }
#badge { min-height: 44px; font-size: 14px; }
.layout {
  display: grid;
  grid-template-columns: minmax(0, 0.84fr) minmax(0, 1.16fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  gap: 16px;
  padding-bottom: 12px;
}
.layout > .play { grid-area: 1 / 1; }
.layout > .desk {
  grid-area: 1 / 2;
  padding: 12px;
  overflow: hidden;
}
.scene { background: linear-gradient(#a7e5ed 50%, #a2d77f 50%); }
.mission p { font-size: clamp(16px, 1.65vw, 21px); line-height: 1.35; }
.desk .pad { flex: 1 1 0; min-height: 0; }
.desk .actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px 52px;
  gap: 8px;
  flex: 0 0 52px;
  margin: 10px 0 0;
}
.actions button { height: 52px; padding: 6px 10px; font-size: 16px; }
#run { font-size: 18px; }
.studio-footer, body > footer {
  display: flex;
  align-items: center;
  flex: 0 0 calc(42px + env(safe-area-inset-bottom));
  min-height: 0;
  padding-bottom: env(safe-area-inset-bottom);
}
body > footer:not(.studio-footer) { justify-content: center; }
.desk #palette {
  align-content: flex-start;
  max-height: clamp(110px, 29vh, 240px);
  gap: 8px;
  margin: 0 0 9px;
  padding: 2px 14px 5px 2px;
  overscroll-behavior: contain;
}
#palette .chip, #palette .value-card {
  min-height: 48px;
  min-width: 48px;
  padding: 7px 12px;
  font-size: 16px;
}
#listing .token, #listing .work-op {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  font-size: 15px;
}
#listing :is(.slot, .work-slot, .repeat-zone, .direction-slot, .action-slot) { min-height: 48px; }
#listing :is(.num, .remove, .field-literal, .field-done, .group-actions button),
#create-tools :is(select, button), .create-link, #chapter-help-button,
#show-me, #next, #answer-form :is(input, button) {
  min-width: 44px;
  min-height: 44px;
}
/* Keep every word in a loop visible. The grouping controls sit below its code. */
#listing .blocks.loop-group {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  grid-template-rows: auto auto;
  gap: 4px;
  align-items: center;
}
#listing .loop-group > .token, #listing .loop-group > .loop-moves { grid-row: 1; }
#listing .loop-group > .group-actions { grid-area: 2 / 1 / 3 / -1; }
#listing .repeat-gap { flex-basis: 23px; height: 42px; }
#listing .line-gap { height: 16px; }
#listing { overscroll-behavior: contain; }
#answer-form > div { min-width: 0; }
#reply { max-width: 100%; }
.desk #next { margin-top: 6px; }
.desk #status, .result-row:has(#feedback:not(:empty)) { margin-top: 6px; }
@media (max-height: 640px) {
  .heading, main > header { height: 60px; flex-basis: 60px; }
  .desk #palette { max-height: 114px; }
}
/* The site's share control and the game footer occupy one row. */
body {
  display: grid;
  grid-template-rows: minmax(0, 1fr) calc(50px + env(safe-area-inset-bottom));
}
main { grid-area: 1 / 1; margin: 0 auto; }
body > footer, body > [data-bk-link-footer] { grid-area: 2 / 1; }
body > [data-bk-link-footer] {
  align-self: center;
  justify-self: center;
  position: relative;
  width: auto;
  max-width: 48vw;
  padding: 0 0 env(safe-area-inset-bottom);
}
body > [data-bk-link-footer] .bk-copy-game-link {
  min-width: 44px;
  border: 0;
  background: transparent;
  padding: 5px 10px;
  font-size: 13px;
}
body > [data-bk-link-footer] .bk-copy-link-address {
  position: absolute;
  bottom: 100%;
  width: min(350px, 65vw);
  max-width: none;
}
