/* Shared mobile action layout, deliberately after both themes. No desktop overrides. */
@media (max-width:760px) {
  html body :is(.seed-head-actions,.hero-actions,.home-recent-heading>div:last-child,
    .project-editor-actions,.settings-page-actions,.asset-action-buttons,.diagnostic-actions,
    .modal-actions,.ca-dialog-actions,.principle-card-actions,.photo-board-tools,
    .pv-scene-actions,.seed-script-actions,.module-image-actions,.ca-actions,.pq-detail-actions,
    .agent-actions:not([data-agent-selected]),.agent-project-controls,.ca-role-title) {
    display:flex;flex-wrap:wrap;align-items:stretch;justify-content:flex-start;
    gap:8px;width:100%;min-width:0;max-width:100%;margin-left:0;white-space:normal;
  }
  html body :is(.seed-head-actions,.hero-actions,.home-recent-heading>div:last-child,
    .project-editor-actions,.settings-page-actions,.asset-action-buttons,.diagnostic-actions,
    .modal-actions,.ca-dialog-actions,.principle-card-actions,.photo-board-tools,
    .pv-scene-actions,.seed-script-actions,.module-image-actions,.ca-actions,.pq-detail-actions,
    .agent-actions:not([data-agent-selected]),.agent-project-controls,.ca-role-title)>:is(button,a):not([hidden]):not(.hidden) {
    display:flex;align-items:center;justify-content:center;flex:1 1 calc(50% - 4px);
    width:auto;min-width:0;max-width:100%;min-height:44px;height:auto;
    padding:10px 12px;margin-left:0;margin-right:0;box-sizing:border-box;
    white-space:normal;overflow-wrap:anywhere;text-align:center;font-size:13px;line-height:1.4;
  }
  /* Titles and controls get separate rows; short titles no longer pull actions to the right. */
  html body .buyer-section-head {flex-wrap:wrap;align-items:flex-start;gap:12px}
  html body .buyer-section-head>div:not(.seed-head-actions) {flex:1 1 calc(100% - 44px);min-width:0}
  html body .buyer-section-head>.seed-head-actions {flex:1 0 100%;margin-left:0}
  html body .buyer-section-head>button {flex:1 0 100%;width:100%;margin-left:0;min-height:44px;height:auto;white-space:normal;padding:10px 12px}
  html body .buyer-side {display:flex;flex-direction:column;gap:12px;width:100%}
  html body .buyer-side>.panel {width:100%;min-width:0}
  html body .topbar {align-items:center}
  html body .topbar>div:first-child {flex:1 0 100%;min-width:0}
  html body .top-actions {width:100%;display:flex;gap:8px;align-items:stretch;margin:0}
  html body .top-actions>button {min-height:44px;height:auto;margin:0}
  html body .top-actions>.icon-button {flex:0 0 44px;width:44px;padding:0}
  html body .top-actions>.primary-button {flex:1;min-width:0;white-space:normal}
  html body .project-context-bar {gap:8px;align-items:center}
  html body .project-context-bar>div {min-width:0;flex:1}
  html body .project-context-bar>button:last-child {flex:1 0 100%;width:100%;margin:0;white-space:normal}
  html body :is(.buyer-page-intro,.buyer-save-row) {align-items:stretch;gap:10px}
  html body .buyer-page-intro>div:has(>.buyer-save-status) {display:flex;align-items:center;gap:10px;width:100%;flex-wrap:wrap}
  html body .buyer-page-intro>div:has(>.buyer-save-status)>button {flex:1;min-height:44px;height:auto;min-width:0}
  html body .buyer-result-toolbar,html body .seed-script-toolbar {flex-wrap:wrap;gap:10px;align-items:center}
  html body :is(.buyer-result-toolbar,.seed-script-toolbar) > div:not(.photo-batch-picker) {width:100%;display:flex;gap:6px;flex-wrap:wrap}
  html body :is(.buyer-result-toolbar,.seed-script-toolbar) > div>button {flex:1;min-width:0;min-height:44px;height:auto;padding:8px 6px;white-space:normal;font-size:13px}
  html body .photo-batch-picker {width:100%}
  html body .photo-batch-picker select {flex:1;min-width:0;min-height:44px}
  html body .library-toolbar {padding:12px;gap:12px}
  html body .library-toolbar>.filter-tabs {width:100%;display:flex}
  html body .library-toolbar>.filter-tabs>button {flex:1;min-height:44px;height:auto;padding:8px;font-size:13px}
  html body .library-project-filter {flex:1 1 100%;min-width:0;width:100%}
  html body .library-project-filter select {flex:1;min-width:0;max-width:100%}
  html body .library-batch-bar>div {width:100%;flex-wrap:wrap;gap:8px}
  html body .library-batch-bar button {flex:1;min-width:0;min-height:44px;height:auto;white-space:normal;padding:8px}
  html body .library-batch-bar span {flex-basis:100%;margin:0}
  html body .result-info {display:grid;grid-template-columns:1fr 44px;gap:8px}
  html body .result-info>div {grid-column:1/-1}
  html body .result-info>button {width:44px;height:44px;margin:0;justify-self:end}
  /* Result cards with controls need enough room; the new photo-only batch grid stays two columns. */
  html body :is(.buyer-result-grid:not(#photoResultGrid),.seed-video-grid),
  html[data-ui=classic] #photoResultGrid {grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr))}
  html body .buyer-result-actions,html body .seed-video-actions {grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px!important;gap:8px}
  html body :is(.buyer-result-actions,.seed-video-actions,.seed-asset-actions)>button {min-width:0;min-height:44px;height:auto;padding:8px;font-size:13px;white-space:normal}
  html body :is(.buyer-result-actions,.seed-video-actions)>button.delete {width:44px;height:auto;min-height:44px}
  html body .seed-asset-actions {grid-template-columns:minmax(0,1fr) 44px;gap:8px}
  html body .seed-asset-actions>button:last-child {width:44px}
  html body .buyer-result-actions:has(>.buyer-extend-control) {grid-template-columns:minmax(0,1fr) 44px!important}
  html body .buyer-result-actions>.buyer-extend-control {grid-column:1/-1;grid-row:2;height:auto;min-height:52px;grid-template-columns:auto minmax(44px,1fr) auto 64px;gap:8px;padding:4px 8px}
  html body .buyer-extend-control input {width:100%;height:44px;font-size:16px}
  html body .buyer-extend-control button {width:64px;min-height:44px;height:auto;font-size:13px}
  html body .project-manage-actions {grid-template-columns:repeat(2,minmax(0,1fr))}
  html body .project-manage-actions button {white-space:normal;height:auto;min-height:44px}
  html body .home-recent-actions button {min-height:44px;height:auto;font-size:13px}
  html body .statistics-intro-actions {flex-wrap:wrap;width:100%;gap:10px}
  html body .statistics-intro-actions>button {flex:1;min-height:44px}
  html body :is(.workspace-switch,.ui-version-switch) button {min-height:44px}
  html[data-ui=next] .next-choice-chips {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}
  html[data-ui=next] .next-choice-chips button {min-width:0;min-height:44px;white-space:normal;padding:10px 8px}
  html body .ca-role-title>b {flex:1 0 100%}
  html body .ca-upload-card>button.secondary-button {width:100%;min-height:44px;white-space:normal}
  html body .modal-actions>span:empty {display:none}
  html body .modal-actions>button {min-width:0}
  html body .modal-head {gap:10px;min-width:0}
  html body .modal-head>div {min-width:0;flex:1}
  html body .modal-head>button {flex-shrink:0;min-width:44px;min-height:44px}
  html body .pq-detail-actions>input {flex:1 1 100%;min-width:0;max-width:100%}
  html body #view-agent .agent-toolbar {flex-direction:column;align-items:stretch}
  html body #view-agent .agent-project-controls {max-width:100%;width:100%}
  html body #view-agent .agent-project-controls>button {min-height:44px;padding:10px 12px}
  html body #view-agent .agent-thread-head {display:flex;gap:8px;align-items:stretch}
  html body #view-agent .agent-thread-head input {flex:1 0 100%;width:100%;min-width:0}
  html body #view-agent .agent-thread-head button {flex:1;min-height:44px;height:auto;padding:10px;font-size:13px}
  html body #view-agent .agent-composer-foot {display:flex;flex-direction:column;align-items:stretch;gap:10px}
  html body #view-agent .agent-composer-foot .agent-actions {gap:8px}
  html body #view-agent .agent-composer-foot button:not(.primary-button) {min-height:44px;padding:10px 12px;font-size:13px}
  html body #view-agent .agent-composer-foot>.primary-button {width:100%;margin:0;min-height:48px}
  /* Keep production controls' flow animation and sizing separate from ordinary actions. */
  html body .agent-actions>.next-production-button {flex:1 0 100%;width:100%;min-height:96px;padding:20px}
}
