/* Desktop objectives are primary; the optional reference never sizes the scene. */
.goal-short-copy{display:none}
body.play-screen .goal-card .goal-order>span .goal-short-copy{display:none}
.detail-goals .goal-short-copy{display:none}
.detail-goals .goal-full-copy{display:block}

@media(min-width:851px),(min-width:600px) and (min-aspect-ratio:11/10){
 body.play-screen #board{
  grid-template-rows:var(--play-goal-height,128px) minmax(0,1fr);
  grid-template-columns:minmax(0,1fr) var(--play-rail-width,220px);
  gap:6px 10px;
 }
 /* One stable strip contains every goal, including the five-goal boards. */
 body.play-screen #board>.goal-card{
  grid-column:1/-1;grid-row:1;order:0;position:relative;display:grid;
  grid-template-columns:minmax(0,1fr) auto 36px;
  grid-template-rows:22px minmax(0,1fr);gap:3px 7px;
  height:100%;min-height:0;max-height:none;overflow:visible;
  padding:5px 7px;border:1px solid #bacab4;border-radius:9px;
 }
 body.play-screen #board>.goal-card>div{display:contents;height:auto}
 body.play-screen #board>.goal-card #goal-context{
  grid-column:1;grid-row:1;display:block;min-width:0;padding:0;margin:0;
  font-size:10px;line-height:22px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
 }
 body.play-screen #board>.goal-card #goal-progress{
  grid-column:2;grid-row:1;display:block;padding:0;margin:0;
  font-size:11px;line-height:22px;white-space:nowrap;
 }
 body.play-screen #board>.goal-card #goal-details-button{
  position:static;grid-column:3;grid-row:1/3;align-self:start;
  width:36px;min-width:36px;min-height:36px;margin:0;padding:2px;
 }
 body.play-screen #board>.goal-card #goal-preview,
 body.play-screen #board>.goal-card #goal-title{display:none!important}
 body.play-screen #board>.goal-card #goal-list{
  grid-column:1/3;grid-row:2;display:grid;grid-auto-flow:column;
  grid-auto-columns:minmax(0,1fr);grid-template-columns:none;grid-template-rows:minmax(0,1fr);
  flex:none;flex-flow:initial;gap:5px;align-items:stretch;
  width:100%;min-width:0;height:100%;min-height:0;max-height:none;
  margin:0;overflow:visible;
 }
 body.play-screen #board>.goal-card .goal-order{
  position:relative;display:grid;grid-template-columns:20px minmax(0,1fr);
  grid-template-rows:40px minmax(0,1fr);gap:1px;align-items:center;
  flex:none;width:100%;min-width:0;height:100%;min-height:0;max-height:none;
  padding:2px 4px;border:1px solid #b9cbb3;border-radius:7px;
  background:#fffaf080;cursor:pointer;
 }
 body.play-screen #board>.goal-card .goal-order>b{
  position:static;grid-column:1;grid-row:1;
  width:20px;height:23px;font-size:11px;align-self:start;z-index:1;
 }
 body.play-screen #board>.goal-card .goal-order>canvas{
  grid-column:2;grid-row:1;display:block;justify-self:center;
  width:100%;max-width:120px;height:40px;min-width:0;object-fit:contain;
 }
 body.play-screen #board>.goal-card .goal-order>span{
  grid-column:1/-1;grid-row:2;display:block;align-self:center;
  width:100%;min-width:0;margin:0;text-align:center;
 }
 body.play-screen #board>.goal-card .goal-order>span strong,
 body.play-screen #board>.goal-card .goal-order>span .goal-full-copy,
 body.play-screen #board>.goal-card .goal-order>span .goal-rule{display:none}
 body.play-screen #board>.goal-card .goal-order>span .goal-short-copy{
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;
  max-height:3.6em;overflow:hidden;margin:0;font-size:12px;line-height:1.2;font-weight:650;
  white-space:normal;overflow-wrap:anywhere;
 }
 body.play-screen #board>.goal-card .goal-order::after{display:none}
 body.play-screen #board>.goal-card .goal-order.ready,
 body.play-screen #board>.goal-card .goal-order.done{border-color:#397b65;background:#e3efdb}
 body.play-screen #board>.goal-card .goal-order.ready::after,
 body.play-screen #board>.goal-card .goal-order.done::after{
  content:'✓';display:block;position:absolute;right:4px;top:3px;
  color:#275f47;font-size:13px;line-height:1;font-weight:900;
 }
 body.play-screen #board>.goal-card .goal-order.lost{border-color:#a33b25;background:#f5e4d8}
 body.play-screen #board>.goal-card .goal-order:focus-visible{outline:3px solid #397d6b;outline-offset:-3px}
 /* Free play has one readable instruction rather than an empty row of goals. */
 body.play-screen #board>.goal-card:has(#goal-list[hidden]) #goal-title{
  display:block!important;grid-column:1/3;grid-row:2;align-self:center;
  font-size:14px;line-height:1.3;margin:0;white-space:normal;overflow-wrap:anywhere;
 }
 /* The right column is exactly the field/control row, regardless of its copy. */
 body.play-screen #play-sidebar{
  grid-column:2;grid-row:2;align-self:stretch;display:flex;flex-direction:column;
  height:100%;min-height:0;max-height:100%;min-width:0;gap:4px;overflow:hidden;
 }
 body.play-screen #play-sidebar-content{
  display:flex;flex:1 1 0;flex-direction:column;
  height:0;min-height:0;max-height:100%;min-width:0;gap:9px;
  overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;
  scrollbar-width:thin;scrollbar-gutter:auto;padding:0 4px 8px;
 }
 body.play-screen #play-sidebar-content>.hud{
  position:sticky;top:0;z-index:3;order:-1;flex:none;
  min-height:54px;margin:0;padding:3px 0 5px;background:var(--cream);
 }
 body.play-screen #play-sidebar-content>.coach{
  order:1;flex:none;height:auto;min-height:0;max-height:none;overflow:visible;padding:0 2px;
 }
 body.play-screen #play-sidebar #puzzle-actions{flex:none;min-height:48px;flex-wrap:wrap}
 /* Expanded reference is a single vertical sequence, using the sidebar scroll. */
 body.play-screen #play-sidebar #merge-chain-strip,
 body.play-screen #play-sidebar #merge-chain-strip.is-collapsed{
  grid-column:auto;grid-row:auto;order:0;display:block;flex:none;
  min-width:0;min-height:44px;height:auto;max-height:none;
  margin:0;padding:3px 5px;border:1px solid var(--line);border-radius:8px;
 }
 body.play-screen #play-sidebar .merge-chain-heading{
  display:grid;grid-template-columns:minmax(0,1fr) 54px 34px;
  grid-template-rows:auto;align-items:center;min-height:36px;gap:3px;
 }
 body.play-screen #play-sidebar #merge-chain-label,
 body.play-screen #play-sidebar #merge-chain-strip.is-collapsed #merge-chain-label{
  position:static;grid-column:1;grid-row:1;display:block;
  width:auto;height:auto;min-width:0;overflow:visible;clip-path:none;
  font-size:11px;line-height:1.2;white-space:normal;overflow-wrap:anywhere;
 }
 body.play-screen #play-sidebar #merge-chain-button,
 body.play-screen #play-sidebar #merge-chain-strip.is-collapsed #merge-chain-button{
  grid-column:2;grid-row:1;align-self:center;min-width:0;width:54px;
  min-height:36px;margin:0;padding:3px;font-size:10px;
 }
 body.play-screen #play-sidebar #merge-chain-collapse,
 body.play-screen #play-sidebar #merge-chain-strip.is-collapsed #merge-chain-collapse{
  grid-column:3;grid-row:1;align-self:center;min-width:34px;width:34px;
  min-height:36px;margin:0;padding:2px;font-size:20px;
 }
 body.play-screen #play-sidebar .merge-chain-scroll{
  grid-column:auto;grid-row:auto;display:block;height:auto;max-height:none;
  min-width:0;width:100%;overflow:visible;
 }
 body.play-screen #play-sidebar #merge-chain-strip.is-collapsed .merge-chain-scroll{display:none}
 body.play-screen #play-sidebar #merge-chain-items{
  display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:none;
  gap:3px;width:100%;min-width:0;margin:2px 0 0;padding:0;overflow:visible;
 }
 body.play-screen #play-sidebar .chain-specimen{
  display:grid;grid-template-columns:46px minmax(0,1fr);grid-template-rows:32px;
  align-items:center;gap:4px;min-width:0;width:100%;min-height:36px;padding:2px 3px;
 }
 body.play-screen #play-sidebar .chain-specimen canvas{grid-column:1;grid-row:1;width:44px;height:28px;object-fit:contain}
 body.play-screen #play-sidebar .chain-animal-name,
 body.play-screen #play-sidebar .chain-specimen strong{
  grid-column:2;grid-row:1;justify-self:start;width:auto;
  font-size:11px;line-height:1.2;text-align:left;white-space:normal;
 }
 body.play-screen #play-sidebar .chain-step:not(:last-child)::after{
  content:'↓';left:22px;right:auto;top:auto;bottom:-5px;z-index:1;
  font-size:12px;line-height:1;color:#82765f;
 }
 body.play-screen #play-sidebar #merge-chain-tip{position:static;width:auto;max-width:none;margin:4px 0;font-size:11px}
 body.play-screen.large-text #board>.goal-card #goal-context,
 body.play-screen.large-text #board>.goal-card #goal-progress{font-size:12px;line-height:22px}
 body.play-screen.large-text #board>.goal-card .goal-order>span .goal-short-copy{font-size:14px;line-height:1.2}
 body.play-screen.large-text #play-sidebar .chain-animal-name{font-size:13px;line-height:1.2}
}
