/* Expand the existing apparatus, retaining its live scene, task and play control. */
.scene-expand { display: none; }
@media (max-width: 1000px) {
  .scene-expand { display: inline-flex; align-items: center; justify-content: center; position: absolute; z-index: 12; top: 6px; right: 6px; min-height: 44px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,253,247,.96); color: var(--green); font-size: 13px; box-shadow: 0 2px 8px rgba(35,79,64,.08); touch-action: manipulation; }
  .scene-caption { max-width: calc(100% - 125px); }
  .learning-tools > .scene-expand { position: static; flex-shrink: 0; box-shadow: none; }
  .mobile-switch > .scene-expand { position: static; flex: 0 0 86px; box-shadow: none; }
  body.scene-expanded > .header, body.scene-expanded > .site-registration,
  .scene-expanded .studio-title, .scene-expanded .studio-tabs { display: none !important; }
  body.scene-expanded .learning-page { padding: max(5px,env(safe-area-inset-top)) max(5px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(5px,env(safe-area-inset-left)); grid-template-rows: minmax(0,1fr); gap: 0; }
  .scene-expanded .studio-workspace { display: block; position: relative; }
  .scene-expanded .apparatus { position: absolute; inset: 0; visibility: visible !important; pointer-events: auto !important; }
  .scene-expanded .guide-panel { display: none !important; }
  .scene-expanded .scene-wrap { margin-inline: 4px; }
}

/* A phone in landscape gives the apparatus the full height, with one side panel. */
@media (max-width: 1000px) and (max-height: 500px) and (orientation: landscape) {
  body.scene-expanded .apparatus { --side-width: clamp(240px,32vw,300px); padding-left: calc(100% - var(--side-width)); border-radius: 12px; }
  .scene-expanded .scene-stack { position: absolute; inset: 5px var(--side-width) 5px 0; min-height: 0; }
  body.studio.scene-expanded .scene-stack:has(> .live-graph) { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); grid-template-rows: minmax(0,1fr); gap: 6px; }
  .scene-expanded .coach-strip { padding: 9px 12px; gap: 3px; flex: 0 0 auto; }
  .scene-expanded .coach-strip > strong { font-size: 16px; }
  .scene-expanded .coach-strip p { font-size: 14px; line-height: 1.5; }
  .scene-expanded .apparatus-head { flex: 0 0 auto; min-height: 36px; padding: 3px 10px; flex-wrap: wrap; }
  .scene-expanded .game-card { min-height: 0; max-height: none; flex: 1 1 auto; padding: 6px 12px 0; }
  .scene-expanded #game-discovery:not([hidden]) { display: block; }
  .scene-expanded .game-options { flex-direction: column; gap: 6px; }
  .scene-expanded .game-options button { min-height: 48px; padding: 7px 10px; font-size: 14px; }
  .scene-expanded .game-card p { font-size: 14px; line-height: 1.5; }
  .scene-expanded .instrument-bar { margin-top: auto; padding: 8px 12px; flex: 0 0 auto; flex-wrap: wrap; }
  .scene-expanded #play { min-height: 48px; min-width: 0; max-width: none; width: 100%; font-size: 16px; }
  .scene-expanded .instruments { flex: 1 0 100%; margin: 0; justify-content: space-between; gap: 8px; }
  .scene-expanded .instruments strong { font-size: 18px; }
  .scene-expanded .apparatus-hint { flex: 0 0 auto; padding: 4px 10px; }
  .scene-expanded .trial-strip { flex: 0 0 32px; }
}
