/* Fit the default sample view into a desktop viewport while keeping long workspaces scrollable. */
@media (min-width:741px) {
  html,body,#app { height:100%; min-height:0; }
  body { overflow:hidden; }
  .studio-shell { height:100dvh; min-height:0; }
  .studio-shell>.main {
    height:100dvh;
    min-height:0;
    padding-top:12px;
    padding-bottom:10px;
    overflow-y:auto;
    overscroll-behavior-y:contain;
    scroll-padding-block:12px;
    scrollbar-gutter:stable;
  }
  .workspace-edge { margin-bottom:4px; }
  #official-preview-guide { margin-bottom:4px; }
  .studio-shell .chat-layout { min-height:calc(100dvh - 148px); }
  .studio-shell .chat-top { min-height:40px; margin-bottom:6px; }
  .studio-shell .chat-empty { padding:5px 0 8px; }
  .studio-shell .chat-empty .brand-inline { width:48px!important; height:48px!important; }
  .studio-shell .chat-empty h1 { margin:12px 0 8px; }
  .studio-shell .chat-empty>p { line-height:1.55; }
  .studio-shell .starter-grid { gap:10px; margin-top:12px; }
  :root .studio-shell .starter-card { min-height:112px; padding:16px; }
  .studio-shell .starter-card>.icon { margin-bottom:10px; }
  .studio-shell .chat-composer { padding:14px 18px 12px; }
  .studio-shell .chat-composer textarea {
    min-height:64px;
    font-size:max(16px,calc(16px + var(--ui-font-offset,0px)))!important;
  }
  .studio-shell .composer-bottom { gap:10px; padding-top:8px; }
  .studio-shell .chat-composer button[data-action="send-chat"] { width:44px; min-width:44px; height:44px; min-height:44px; }
  .studio-shell .chat-disclaimer { line-height:1.55; margin-top:4px; }
  .studio-shell .chat-extra-tools { gap:6px; margin-top:4px; padding-bottom:4px; }

  /* Keep the creation workspace controls in the first view; let long forms scroll in their own panel. */
  .studio-shell .page-head { margin-bottom:10px; }
  .studio-shell .sectionbar { margin-bottom:10px; }
  .studio-shell .create-grid { grid-template-columns:minmax(280px,.82fr) minmax(0,1.18fr); gap:16px; min-width:0; }
  .studio-shell .create-grid > * { min-width:0; }
  .studio-shell .editor-panel { display:flex; flex-direction:column; min-height:0; }
  .studio-shell .editor-panel > .panel-body { min-height:0; max-height:calc(100dvh - 326px); overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
  .studio-shell .editor-panel .generate-row { position:sticky; bottom:-20px; z-index:2; margin:0 -20px -20px; padding:12px 20px 16px; border-top:1px solid var(--hair); background:var(--surface); }
  .studio-shell .preview-panel { min-width:0; }

  /* The canvas inspector already owns its own scroll area; scale its board to available height. */
  .studio-shell .canvas-page-head { margin-bottom:10px; }
  .studio-shell .canvas-modebar { margin-bottom:8px; }
  .studio-shell .canvas-page-head ~ .wm-create-control { padding:9px 12px; gap:6px 10px; margin-bottom:9px; }
  .studio-shell .canvas-page-head ~ .wm-create-control > p { line-height:1.4; }
  .studio-shell .cv-shell { height:min(620px,calc(100dvh - 382px)); min-height:340px; }

  /* Keep editing controls and preview visible while the long timeline stays independently usable. */
  .studio-shell .editing-grid { grid-template-columns:minmax(0,1.6fr) minmax(250px,1fr); gap:16px; min-width:0; height:min(500px,calc(100dvh - 350px)); min-height:340px; }
  .studio-shell .editing-grid > * { min-width:0; min-height:0; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
  .studio-shell .timeline-panel { max-height:180px; overflow:auto; overscroll-behavior:contain; scrollbar-gutter:stable; margin-top:14px; }
  .studio-shell .timeline-ruler { min-width:620px; }

  /* Library filters/folders stay in view; every asset remains reachable in the scrollable grid. */
  .studio-shell .library-toolbar { margin-bottom:12px; min-width:0; flex-wrap:wrap; }
  .studio-shell .folder-bar { margin-bottom:12px; }
  .studio-shell .asset-grid { max-height:calc(100dvh - 402px); min-height:160px; overflow:auto; align-content:start; overscroll-behavior:contain; scrollbar-gutter:stable; padding:2px 3px 8px 0; }
  .studio-shell .asset-grid > * { min-width:0; }

  /* Settings navigation remains available while every settings group stays in the content scroller. */
  .studio-shell .settings-layout { grid-template-columns:minmax(150px,172px) minmax(0,1fr); gap:20px; height:calc(100dvh - 238px); max-height:calc(100dvh - 238px); min-height:300px; min-width:0; }
  .studio-shell .settings-nav { position:sticky; top:0; align-self:start; max-height:100%; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
  .studio-shell .settings-content { min-width:0; height:100%; max-height:100%; overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; padding:0 8px 18px 0; }

  /* Short desktop and browser zoom keep grids inside the available content width. */
  .studio-shell>.main { min-width:0; }
  .studio-shell .settings-layout > *, .studio-shell .library-toolbar > *, .studio-shell .folder-bar > * { min-width:0; }
  .studio-shell .modal { max-width:calc(100vw - 36px); max-height:calc(100dvh - 32px); overflow:auto; }
}

@media (min-width:741px) and (max-width:1100px) {
  .studio-shell>.main { padding-inline:16px; }
  .studio-shell .create-grid { grid-template-columns:minmax(250px,.9fr) minmax(0,1.1fr); gap:12px; }
  .studio-shell .settings-layout { grid-template-columns:minmax(128px,150px) minmax(0,1fr); gap:12px; }
  .studio-shell .asset-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width:740px) {
  .studio-shell>.main { overscroll-behavior-y:contain; }
}

@media (prefers-reduced-motion:reduce) {
  .studio-shell>.main { scroll-behavior:auto; }
}
